Jump to content

what are all the algorithms involved in finding a solution with numerical methods ??


Recommended Posts

Posted (edited)

 

An Example

 

Say we were to solve the initial value problem:

 

y′ = 2x

 

y(0) = 0

 

It's so simple, you could find a formulaic solution in your head, namely y = x2. On the other hand, say we were to use a numerical technique. (Yes, I know we don't know how to do this yet, but go with me on this for a second!) The resulting numerical solution would simply be a table of values. To get a better feel for the nature of these two types of solution, let's compare them side by side, along with the graphs we would get based on what we know about each one:

 

Notice that the graph derived from the formulaic solution is smoothly continuous, consisting of an infinite number of points on the interval shown. On the other hand, the graph based on the numerical solution consists of just a bare eight points, since the numerical method used apparently only found the value of the solution for x-increments of size 0.2.

 

 

Using Numerical Solutions

 

So what good is the numerical solution if it leaves out so much of the real answer? Well, we can respond to that question in several ways:

 

The numerical solution still looks like it is capturing the general trend of the "real" solution, as we can see when we look at the side-by-side graphs. This means that if we are seeking a qualitative view of the solution, we can still get it from the numerical solution, to some extent.

 

The numerical solution could even be "improved" by playing "join-the-dots" with the set of points it produces. In fact this is exactly what some solver packages, such as Mathematica, do do with these solutions. (Mathematica produces a join-the-dots function that it calls InterpolatingFunction.)

 

When actually using the solutions to differential equations, we often aren't so much concerned about the nature of the solution at all possible points. Think about it! Even when we are able to get formulaic solutions, a typical use we make of the formula is to substitute values of the independent variable into the formula in order to find the values of the solution at specific points. Did you hear that? Let me say it again: to find the values of the solution at specific points. This is exactly what we can still do with a numerical solution

 

 

 

 

 

Numerical Methods and errors

Interpolation

Numerical Differentiation

Numerical Integration

Solution of Algebraic and Transcendental Equations

Numerical Solution of a system of Linear Equations

Numerical Solution of Ordinary differential equations

Curve fitting

Numerical Solution of problems associated with Partial Differential Equations

 

 

Fixed Point Iteration Method

Bisection and Regula False Methods

Newton Raphson Method etc.

Finite Differences Operators

Numerical Interpolation

Newton’s and Lagrangian Formulae

Part I

Newton’s and Lagrangian Formulae

Part II

Interpolation by Iteration

Numerical Differentiaton

Numerical Integration

Solution of System of Linear

Equations

Solution by Iterations

Eigen Values

Taylor Series Method

Picard’s Iteration Method

Euler Methods

Runge – Kutta Methods

Predictor and Corrector Methods

 

my questions sort of looks a bit like this ...

 

numerical_methodds.jpg

 

numerical_solutions.png

 

 

 

euler_algorithm.png

 

 

??

Edited by bimbo36
Posted (edited)

hi , really I could not find the best expression of your query to be questioned.but I suggest that you check this rule in mathematical science at first (please) (whether you are missing this point (!))

 

 

 

examples cannot be accepted as proof to prove allegements in mathematics. but we can use example to make/create contradiction (if contradiction exists (at real)) compare please ;

 

"if you say ; all peaople are generous " and then if you want to make contradiction (because ,you think this is not true )) ,then it would be enough to give at least one opposite example (a penurious person) to refute it. but if you want to show any allegemnt like above was true ,you cannot use giving example that comply/approve allegement. this will never be solution type. you can use some determined techniques (and this are already familiar at real ,and not so many) . induction , proving directly...)

Edited by blue89
Posted

 

A numerical iteration method or simply iteration method is a mathematical

procedure that generates a sequence of improving approximate solutions for a class of

problems. A specific way of implementation of an iteration method, including the

termination criteria, is called an algorithm of the iteration method. In the problems of

finding the solution of an equation an iteration method uses an initial guess to generate

successive approximations to the solution.

 

i am so confused ...

 

what is this initial guess ??

 

 

the initial guess of what ??

Posted

i am sorry for the long posts ... as i learn more , the size of the post seems to be getting smaller ...

i really need to understand how these works ...



lagrange's interpolation formula
newton raphson method
bisection method
eulers method
newtons forward
runge kutta method
trapezoidal rule


and i dont have one text that explains it all ...

Posted (edited)

1)

 

 

i am so confused ...

 

 

2)

 

 

lagrange's interpolation formula
newton raphson method
bisection method
eulers method
newtons forward
runge kutta method
trapezoidal rule


and i dont have one text that explains it all ...

 

 

all these cannot be told at forum (because of their wide content (but basic)), the best way to do is having any litearature to learn these , but these are not so difficult subjects...(&basic)

 

you can find almost all of these subjects with details at any numerical analysis ((suitable)book) for BSc students.

Edited by blue89
Posted

i have been trying to follow at least this much amount of books ...

 

 

Peter Selby, Steve Slavin Practical Algebra_ A Self-Teaching Guide

Tom M. Apostol Calculus, Volume I_ One-Variable Calculus, with an Introduction to Linear Algebra

Tom M. Apostol Calculus, Volume II_ Multi-Variable Calculus and Linear Algebra, with Applications to Differential Equations and Probability
Numerical Analysis by Richard L. Burden (Author), J.Douglas Faires (Author), Annette M. Burden
Computer oriented numerical methods - N Datta

Computer Fundamentals and Programming in C - J.B. Dixit

 

i have few doubts ...

 

how to find an initial guess ... ??

 

 

 

Nonlinear optimization routines enable you to find the values of variables that optimize an objective function of those variables. When you use a numerical optimization routine, you need to provide an initial guess, often called a "starting point" for the algorithm. Optimization routines iteratively improve the initial guess in an attempt to converge to an optimal solution. Consequently, the choice of a starting point determines how quickly the algorithm converges to a solution and—for functions with multiple local extrema—to which optimum the algorithm converges.

But how can you produce a "good" starting point for multivariate functions? Some analysts use a constant vector, such as a vector of all 0s or a vector of all 1s. Although this practice is widespread, this default initial guess might not converge to a global extremum. You can usually do better by choosing a starting point that is based on a few easy evaluations of the objective function.

 

 

i am also trying to understand the steps involved , in these two questions ...

 

 

ccc_numerical_methods_png_2.png

ccc_numerical_methods_png_3.png

 

ccc_numerical_methods_png_1.png

 

ccc_numerical_methods_1.png

 

ccc_numerical_methods_2.png

 

 

 

first we are given a gradient of the curve or an instantaneous rate of change

 

then we are trying to find a function that is giving this gradient of the curve or this instantaneous rate of change

 

then we change the dy/dx , the gradient of the curve or an instantaneous rate of change to ... delta y /delta x which is an even smaller gradient of the curve or a smaller instantaneous rate of change ...

 

we start with x = 0 , we get y =0

 

when we increment x by 0.1 , we get the value of y around -0.299

 

which is another gradient of the curve for delta y / delta x , the smaller instantaneous rate of change

 

why are we adding up these gradients of the curve or the smaller instantaneous rate of change for these small small change in delta y / delta x?

 

this means that these smaller gradients of the curve or these smaller instantaneous rate of change has certain property at each value of x ..., the gradient of the curve with respect to x which is indeed "the rate" at which y is changing as x is changing ....

 

so the function has the property of this "rate" ???

 

usually , when we try to solve ...

 

 

 

 

we get a function that has this instantaneous rate of change ...

 

but when we try to solve it with numerical methods , we only get a " rate " which is the property of that function ???

Posted

hey dear binbo36 ;

 

why you are feeling so exciting :) :) (this is my prediction does not show the truth). :)

ok. now I am unable to evaluate all sharing ..(it is not difficult to read so long post ( this is not the exact matter ,now I have no enough time but of course it would be better you to write part to part sameller).

 

now ,I may say theese;

 

really I have been wondering that question why we were using differential quantities,espeacially when I was at my first class at BSc level.

 

I learnt and added my own idea that simply it provides us easier conditions to work with computations & formulizations ,or to better understand them.(more clearly)

 

however there are assumption some approxiamtions in our calculations. there exist something similar things at another usages (not only at your question above.) look like this ;

 


if we say any sequesnce's limit is a (let the our squence be shown as (an). then we write so this according to mathematical principle as ;

 

for any ɛ>o ,there exist at least one Nɛ ordinal number that for all n>Nɛ

 

I an - a I < ɛ ,check please the ɛ's value is not clear (static) ,it is changing ,but we define it as ɛ and we already say that it has enough low ranking. (but again there may exist bigger differences between ɛ's value there implied and in our mind (we can differ it via giving values).

 

I think although this is simple and quite basic example ,is similar.

 

does this help?

Posted

unfortunately i only understand this part clearly ...

 

ccc_numerical_methods_png_3.png

ccccmaths_5_4.png

 

i don't understand the importance of function values or what they actually mean ...

 

ccc_numerical_methods_png_2.png

 

??

Posted (edited)

could you determine that which expression is the best suitable for your question below..

 

1-->> "I wonder whether iteration's properties affects the results" or ""...how affect the results."

 

2-->> "I would learn why we use differential notations or approxiamtions & equations "

Edited by blue89
Posted

i don't know if i am understanding this properly ...

 

 

 

this thread , post # 8 ...

 

 

picture one ..

 

 

that question is about finding the "function" that has that instantaneous rate of change ... right ??

we found the function ... that has that rate of change ...

 

same thread picture two ,

 

we are given a function and we are trying to solve it numerically ...

if you take dy/dx of that instantaneous rate of change you get certain properties of that function at certain points or places ...

 

then if you increment x ... you get properties of that function again at certain points or places

 

if you add all the function values ... you get the overall properties of a function ...

 

and that is the function with all those properties that has given that instantaneous rate of change ... ??

 

??

Posted (edited)

ok , I am reporting some details and some related things that I think might eradicate the problem you think...

 

but unfortunately because of I do not know using LaTeX ,I will write the equations in normal form.

 

howevever i have photo machine but I do not know how to upload there. (I would write by my own pen :) )

 

it might be abit long and so , please wait until you see this notation at the end of comment.

 

"this is the end of reply"


unfortunately i only understand this part clearly ...

 

 

ccccmaths_5_4.png

 

i don't understand the importance of function values or what they actually mean ...

 

 

 

??

 

to begin with , I recommend that you look for some materials whiches are related numerical analysis (directly) instead differential equations.

 

then ... As you see this related with integrate's main properties , it would be very good to remember/remind some properties about Riemann Rntegral and the different forms of the theiries relevant this. (especially fundamental theorie and some other basic theories but under convenience of surveys at numerical analysis (not general analysis / calculus ,of course these may mek you better undertand ,but at first look the numerical analysis I mean.)

 

wait please..

Edited by blue89
Posted (edited)

i like this sentence actually ...

 

 

could you determine that which expression is the best suitable for your question below..

 

1-->> "I wonder whether iteration's properties affects the results" or ""...how it affect the results."

 

 

 

 

is iteration like another word for numerical methods ??

 

 

and we are trying to iterate the instantaneous rate of change ... in the question right ?

 

ccc_numerical_methods_png_2.png

and the Euler's method is one such iteration for ... the instantaneous rate of change in the question ...

 

euler_algorithm.png

 

 

 

 

 

 

after these iterations with the help of these algorithms ...

 

 

we get function values ...

 

then if you increment x ... you get properties of that function again at certain points or places

 

if you add all the function values ... you get the overall properties of a function ...

 

and that is the function with all those properties that has given that instantaneous rate of change ...

 

??

Edited by bimbo36
Posted (edited)

do not please write anything until my expressions be ended :) and renew your page time to time how possible is.

 

yes furthermore I realised that your question (probnlem was more relevant the first one.

 

tecnhical errors ..

 

I cannot edit the first comment!...

 

being continued there...


the first picture already was showing that in differenatial equations we are not trying to find unique solution. (if there was no information like this you given

y(0)= 5 ,y(1)= 12 ... (at else statements the value of K mean there are not the unique solution for our equation(s). but already this is not relevant your answer that might solve your question or make your thoughst clarify....

wait please..


unfortunately i only understand this part clearly ...

 

 

 

 

i don't understand the importance of function values or what they actually mean ...

 

ccc_numerical_methods_png_2.png

 

??

 

 

your exact problem is not about the values of function (this does not express properly and particularly)...the exact problem is more relevant with the content of interpolation & trapez technique and these techniques have been improved / creted from the riemann calculating the intregral forms at real ..

 

 

remember please what were we doing or how were we constructing the rieamann integral (wait please ,I will use your own grapphic)


ccc_numerical_methods_2.png

 

look carefully please to this grapphic ...

let use these data's to understand well how we were constructing the rieman integrall ...

look the iteration for instance x values 0.4-0.6 ...

the riemann integral form was saying to us that we were calculating/constructing the formula via using this ;

(once we were dividind the field to small parts as possible as is but how were we constructing the riemann formula ? follow please!..)

 

RIEMANN THEORIES IS HIGHLY IMPORTANT YOU WILL UNDERSTAND THIS ,

 

and follow ;


when our that value of function was mx , we were saying that

but ∆x must have been small and smaller how possible was at rieamnn integrall ,to reach the most actual reasults.

then when

(∆x --> 0 )

 

 

the result were being ;

∑ mx.∆x

but we know that there were no both definite ∆x values own and the actual mx=f(xt) because were assuming that it was the result of our limit form above ((approxiamtion) not the certain)


!!: renew you page please time to time ,because of technical errorrs I may change something...

 

wait please..

 

 

all these means actually the iterations are very important...(the same meaning is , how you make smaller your interval , how you will find the best results!...but again this will not change that it was the APPROXIMaTION . and Just this means that you will never be able to find the actual result!..

 

 

wait please..


RESULT 1: you will be able to find the better result if you make your interval smaller/tighter. (THİS MEANS ,IF YOU RISE YOUR İTERATION'S NUMBER ,THEN YOU WILL FIND BETTER RESULTS (MORE APPROXIMATIVE TO THE BEST.)

 

 

you can find some other forms and something are different in comparison each forms but all results will/should support each them :)

 

like this ;

 

look this picture and REMEMBER ;

 

turev-tanim.jpg

 

what it was defining at value of x=x0 (this was a special point)? ...........


at x=x0 value

 

if we write f'(x) = h(x)

 

h(x0) were being our tangent function of f(x)

 

then we were able to write any equation in cartesian form (analytic geometry)

 

 

y-y0= h(x0) (x-x0) (but t(x0,y0) were given) thats why ,h(x) were any function's tangent function at its derivation at any given point like t)

 

 

this is probably is related with your this picture if you look more carefully

 

 

https://s32.postimg.org/x0hl5isj9/ccc_numerical_methods_png_2.png


RESULT 2: you need the various shape of riemann integral forms of theorie (to understand well )

 

riemann interall form of theorie is one of the most important theories (espeacilly at all subjects related integration)

 

this means it may provide you ..some better knowledge.

 

 

and the iteration will provide you more sensitive results. lets check the grapphic again.

ccc_numerical_methods_2.png

 

if we do not use the smallest intervals ,then already we will find the results like marked errorr one above.

 

if we do not use the suiatble iterations the we will find the results above marked as numerical approach

 

the best result (exact soltion (shown above with red line) is the under convenient limit form of rimemann integral

 

 

now this is the end of my comment.

Edited by blue89
Posted

blue89 ,

 

thanks a lot for the replies ...

 

your maths looks a bit too advanced to me ...

 

i am a bsc computer science student ... and we had this "computer oriented numerical methods in c language " in college ...

 

our practical lab , involved solving 7 questions with numerical methods...

 

numerical_methodds.jpg

 

at that time , i was not aware of the depth of this subject ...

 

since then , i have been trying to understand this ...

 

my understanding so far is , that we are dealing with .... iterations of the "instantaneous rate of change " in the question ...

 

 

 

 

1-->> "I wonder whether iteration's properties affects the results" or ""...how it affect the results."

 

at this point of time , i am not exactly sure how the algorithms , or the iteration properties affects the results ...

 

finding delta y / delta x for an instantaneous rate of change is like already a step for approximating or finding function values ...

 

ccc_numerical_methods_png_2.png

 

ccc_numerical_methods_2.png

 

 

i guess the euler's method is one such algorithm to take smaller intervals of the instantaneous rate of change in the question ...

 

euler_algorithm.png

 

turev-tanim.jpg

 

ccc_numerical_methods_2.png

 

 

 

 

i have learned from your post that , the smaller the interval .. the much clearer the properties of the function we are trying to find ...

 

??

Posted (edited)
blue89 ,

 

thanks a lot for the replies ...

 

your maths looks a bit too advanced to me ...

 

 

I am MSc student at mathematics. really I think the riemann form is very important.

 

and your this comment is the best of your expressions!..

 

 

 

 

i have learned from your post that , the smaller the interval .. the much clearer the properties of the function we are trying to find ...

 

 

 

sure!..

Edited by blue89
Posted

blue89 ,

 

Thanks a lot for all the explanations ...

:wub:

inmtimately I feel me very very happy when/if I help someone :)

 

:cool::wub:

Posted

thanks to you ..

 

from now on i can focus a bit more on programming ... rather than spent all my time in front of mathematics ...

Posted

thanks to you ..

 

from now on i can focus a bit more on programming ... rather than spent all my time in front of mathematics ...

 

yes. I do not know exactly but probably you are able to make your interval smaller ...using via this command

 

program calc

implicit none

 

...

 

..

 

do i= 1,20 ( instead i=1,10)

 

..

..

 

stop

end

Posted

programming is a lot more harder than that ...

 

on a usual case ...

 

we are given problems like these only...

 

 

 

 

 

numerical_methodds.jpg

 

 

An Example

Say we were to solve the initial value problem:

y′ = 2x

y(0) = 0

It's so simple, you could find a formulaic solution in your head, namely y = x2. On the other hand, say we were to use a numerical technique. (Yes, I know we don't know how to do this yet, but go with me on this for a second!) The resulting numerical solution would simply be a table of values. To get a better feel for the nature of these two types of solution, let's compare them side by side, along with the graphs we would get based on what we know about each one:

Notice that the graph derived from the formulaic solution is smoothly continuous, consisting of an infinite number of points on the interval shown. On the other hand, the graph based on the numerical solution consists of just a bare eight points, since the numerical method used apparently only found the value of the solution for x-increments of size 0.2.


Using Numerical Solutions

So what good is the numerical solution if it leaves out so much of the real answer? Well, we can respond to that question in several ways:

The numerical solution still looks like it is capturing the general trend of the "real" solution, as we can see when we look at the side-by-side graphs. This means that if we are seeking a qualitative view of the solution, we can still get it from the numerical solution, to some extent.

The numerical solution could even be "improved" by playing "join-the-dots" with the set of points it produces. In fact this is exactly what some solver packages, such as Mathematica, do do with these solutions. (Mathematica produces a join-the-dots function that it calls InterpolatingFunction.)

When actually using the solutions to differential equations, we often aren't so much concerned about the nature of the solution at all possible points. Think about it! Even when we are able to get formulaic solutions, a typical use we make of the formula is to substitute values of the independent variable into the formula in order to find the values of the solution at specific points. Did you hear that? Let me say it again: to find the values of the solution at specific points. This is exactly what we can still do with a numerical solution

numerical_solutions.png

 

 

euler_algorithm.png

 

 

turev-tanim.jpg

 

ccc_numerical_methods_2.png

 

 

 

i think it would be a good idea to focus on those 7 programs instead of going after the things outside the syllabus ...

 

 

Posted

i might be able to program all those 7 programs properly in Dev c++ ...

 

 

 

numerical_methodds.jpg

 

numerical_method_formula_note_1.png

 

 

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float x[10],y[10],temp=1,f[10],sum,p;
int i,n,j,k=0,c;
clrscr();
printf("\nhow many record you will be enter: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n\nenter the value of x%d: ",i);
scanf("%f",&x);
printf("\n\nenter the value of f(x%d): ",i);
scanf("%f",&y);
}
printf("\n\nEnter X for finding f(x): ");
scanf("%f",&p);

for(i=0;i<n;i++)
{
temp = 1;
k = i;
for(j=0;j<n;j++)
{
if(k==j)
{
continue;
}
else
{
temp = temp * ((p-x[j])/(x[k]-x[j]));
}
}
f=y*temp;
}

for(i=0;i<n;i++)
{
sum = sum + f;
}
printf("\n\n f(%.1f) = %f ",p,sum);
getch();
}

 

 

/*
______________________________________

OUT PUT
______________________________________

how many record you will be enter: 4


enter the value of x0: 0


enter the value of f(x0): 0


enter the value of x1: 1


enter the value of f(x1): 2


enter the value of x2: 2


enter the value of f(x2): 8


enter the value of x3: 3


enter the value of f(x3): 27


Enter X for finding f(x): 2.5


f(2.5) = 15.312500


*/

 

 

lagrange.png

 

 

i have few more doubts ...

 

in certain equations why do we change the unit of x to delta x , and the unit of y to delta y ??

 

Posted (edited)

hi ;

 

bimbo ,as it expressed , I syggest that you look other documents (especially when you feel that was including absences)

 

but do not forget , mathematics has a different language and its discipline is not easy generally , doing these may help you when you are studying.

 

-->> read 1 or 2 sentences (with its formula if it contains) and write it. writing something is making something clear in mathematics (really).

-->> unless you understand after you wrote one or twice or also three times , do not panic! , it is quite normal.write it again.

-->> in almost every part of mathematics , the reason is everytime important. ask to you by your own this question ." why...............?"

-->> looking for some different documents may help you. pure mathematics is generally pleasure , but it is being quite strict problem when you do not study periodically at the same time.

 

 

about your last question (directly) :

 

I think you are confusing numerical abalysis subjects & diferential equations subjects :) :-)

 

these two lesson are separate (don't rely on the notations and some definitions) look the topics of subjects..

 

(furthermore ,it would be very good if you write/wrote something more clearly (succintly ) ) :) :)

 

good luck!

 

blue89

Edited by blue89
Posted (edited)

blue89,

 

thanks a lot for all that helpful posts ...

 

i have been trying to follow this book ..for sometime now ...

 

i have managed it this far ...

 

numerical_analysis.jpg

numerical_methods.png

 

numerical_methods_2.png

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float x[10],y[10],temp=1,f[10],sum,p;
int i,n,j,k=0,c;
clrscr();
printf("\nhow many record you will be enter: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n\nenter the value of x%d: ",i);
scanf("%f",&x[i]);
printf("\n\nenter the value of f(x%d): ",i);
scanf("%f",&y[i]);
}
printf("\n\nEnter X for finding f(x): ");
scanf("%f",&p);

for(i=0;i<n;i++)
{
temp = 1;
k = i;
for(j=0;j<n;j++)
{
if(k==j)
{
continue;
}
else
{
temp = temp * ((p-x[j])/(x[k]-x[j]));
}
}
f[i]=y[i]*temp;
}

for(i=0;i<n;i++)
{
sum = sum + f[i];
}
printf("\n\n f(%.1f) = %f ",p,sum);
getch();
}
/*
______________________________________

OUT PUT
______________________________________

how many record you will be enter: 4


enter the value of x0: 0


enter the value of f(x0): 0


enter the value of x1: 1


enter the value of f(x1): 2


enter the value of x2: 2


enter the value of f(x2): 8


enter the value of x3: 3


enter the value of f(x3): 27


Enter X for finding f(x): 2.5


f(2.5) = 15.312500


*/

lagrange.png

#include<stdio.h>
#include<math.h>
  
  
main()
{
                            
      float x;                                                                  /*defining variables*/
      float y;
      float h;
      float targetx;
        
       
        
      puts("This program will solve the differential equation y' = y - x \nusing Euler's Method with y(0)=1/2 \n\n");
      puts("Please enter the desired constant step size. (h-value)\n\n");
      scanf("%f", &h);                                                           /* Defining step size*/
      puts("\n\nNow enter the desired x-value to solve for y.\n\n");
      scanf("%f", &targetx);
        
      y = 0.5;
      x = 0.0;
        
      puts("\n\nX                Y");
        
      while ( x != targetx )
      {
        
      printf("\n\n%f     %f", x, y);
        
      y = y + ((y - x)*h);
        
      x= x+h;
      }
         
      printf("\n\n%f     %f\n", x, y);
        
      printf("\nThe value of y at the given x is %f.\n\n", y, h);
             
      system("pause");
        
}

euler_algorithm.png

 

 

i think these root finding algorithms for polynomial equations does not involve factorization ...

 

 

i think i should find more examples of equations to solve by numerical techniques involving polynomials and differential equations ...

 

??

Edited by bimbo36
Posted (edited)

i am still confused about ceratin things ...

i have few more doubts ...

i was trying to learn "computer oriented numerical methods in c programming language "

we had a messed up syllabus ...

it was supposed to start with a program for a polynomial factorization first ... but i cannot even find one example program of a polynomial factorization in c in any texts or online...

so i have been trying to re arrange the whole syllabus , so that it becomes something nice to look at and easy to learn ...

 

i have been following at least this much amount of books to narrow it down ...

 

 

Peter Selby, Steve Slavin Practical Algebra_ A Self-Teaching Guide
Tom M. Apostol Calculus, Volume I_ One-Variable Calculus, with an Introduction to Linear Algebra
Tom M. Apostol Calculus, Volume II_ Multi-Variable Calculus and Linear Algebra, with Applications to Differential Equations and Probability
Numerical Analysis - Richard L. Burden (Author), J. Douglas Faires (Author), Annette M. Burden (Author)
Computer oriented numerical methods - N Datta
Computer Fundamentals and Programming in C - J.B. Dixit

numerical_methods.png

 

 

numerical_methods_2.png

 

 

 

An analytical solution to a problem is one that has a "proof": a series of logical steps that can be followed and verified as correct. If you use the quadratic formula to solve for x in a quadratic equation, this is an analytical solution to the problem.

In contrast to this, some problems are solved via other means. If, instead of using the quadratic formula, you try a lot of values for x and y, this is a numerical solution. Some problems simply do not have analytical solutions and must be approximated using numerical methods -- for example, many complicated integrals.

 

 

for example ...

 

this is an instantaneous rate of change , find the function ...

 

cccc_maths_3_1.png

 

ccccmaths_5_4.png

 

and the answer is a function that has the property of ,this instantaneous rate of change ...

 

 

 

 

example 2 :

 

this is an instantaneous rate of change ...

find the function ,the solution , the answer which is a set of points that has certain underlying qualitative property which produced, this instantaneous rate of change ...

 

 

 

Say we were to solve the initial value problem:

y' = 2x

y(0) = 0

It's so simple, you could find a formulaic solution in your head, namely y = x2. On the other hand, say we were to use a numerical technique. (Yes, I know we don't know how to do this yet, but go with me on this for a second!) The resulting numerical solution would simply be a table of values. To get a better feel for the nature of these two types of solution, let's compare them side by side, along with the graphs we would get based on what we know about each one:

Notice that the graph derived from the formulaic solution is smoothly continuous, consisting of an infinite number of points on the interval shown. On the other hand, the graph based on the numerical solution consists of just a bare eight points, since the numerical method used apparently only found the value of the solution for x-increments of size 0.2.


Using Numerical Solutions

So what good is the numerical solution if it leaves out so much of the real answer? Well, we can respond to that question in several ways:

The numerical solution still looks like it is capturing the general trend of the "real" solution, as we can see when we look at the side-by-side graphs. This means that if we are seeking a qualitative view of the solution, we can still get it from the numerical solution, to some extent.

The numerical solution could even be "improved" by playing "join-the-dots" with the set of points it produces. In fact this is exactly what some solver packages, such as Mathematica, do do with these solutions. (Mathematica produces a join-the-dots function that it calls InterpolatingFunction.)

When actually using the solutions to differential equations, we often aren't so much concerned about the nature of the solution at all possible points. Think about it! Even when we are able to get formulaic solutions, a typical use we make of the formula is to substitute values of the independent variable into the formula in order to find the values of the solution at specific points. Did you hear that? Let me say it again: to find the values of the solution at specific
points. This is exactly what we can still do with a numerical solution

 

 

numerical_solutions.png

#include<stdio.h>
#include<math.h>
  
  
main()
{
                            
      float x;                                                                  /*defining variables*/
      float y;
      float h;
      float targetx;
        
       
        
      puts("This program will solve the differential equation y' = y - x \nusing Euler's Method with y(0)=1/2 \n\n");
      puts("Please enter the desired constant step size. (h-value)\n\n");
      scanf("%f", &h);                                                           /* Defining step size*/
      puts("\n\nNow enter the desired x-value to solve for y.\n\n");
      scanf("%f", &targetx);
        
      y = 0.5;
      x = 0.0;
        
      puts("\n\nX                Y");
        
      while ( x != targetx )
      {
        
      printf("\n\n%f     %f", x, y);
        
      y = y + ((y - x)*h);
        
      x= x+h;
      }
         
      printf("\n\n%f     %f\n", x, y);
        
      printf("\nThe value of y at the given x is %f.\n\n", y, h);
             
      system("pause");
        
}

euler_algorithm.png

 

 

here the solution is a set of points or a table of values that has certain underlying qualitative property which produced, this instantaneous rate of change ...

??

Edited by bimbo36
Posted

just a bit of an update of the last post ...

 

i am adding one more text and some algorithm notes too , to it ...

 

 

Peter Selby, Steve Slavin Practical Algebra_ A Self-Teaching Guide
Tom M. Apostol Calculus, Volume I_ One-Variable Calculus, with an Introduction to Linear Algebra
Tom M. Apostol Calculus, Volume II_ Multi-Variable Calculus and Linear Algebra, with Applications to Differential Equations and Probability
Numerical Analysis - Richard L. Burden (Author), J. Douglas Faires (Author), Annette M. Burden (Author)

Numerical recipes in C -The Art of Scientific Computing
Computer oriented numerical methods - N Datta
Computer Fundamentals and Programming in C - J.B. Dixit

 

numerical_methods.png

 

numerical_methods_2.png

 

 

An analytical solution to a problem is one that has a "proof": a series of logical steps that can be followed and verified as correct. If you use the quadratic formula to solve for x in a quadratic equation, this is an analytical solution to the problem.

In contrast to this, some problems are solved via other means. If, instead of using the quadratic formula, you try a lot of values for x and y, this is a numerical solution. Some problems simply do not have analytical solutions and must be approximated using numerical methods -- for example, many complicated integrals.

 

 

for example ...

 

this is an instantaneous rate of change , find the function ...

 

cccc_maths_3_1.png

 

ccccmaths_5_4.png

 

and the answer is a function that has the property of ,this instantaneous rate of change ...

 

 

 

example 2 :

 

this is an instantaneous rate of change ...

find the function ,the solution , the answer which is a set of points that has certain underlying qualitative property which produced, this instantaneous rate of change ...

 

 

Say we were to solve the initial value problem:

y' = 2x

y(0) = 0

It's so simple, you could find a formulaic solution in your head, namely y = x2. On the other hand, say we were to use a numerical technique. (Yes, I know we don't know how to do this yet, but go with me on this for a second!) The resulting numerical solution would simply be a table of values. To get a better feel for the nature of these two types of solution, let's compare them side by side, along with the graphs we would get based on what we know about each one:

Notice that the graph derived from the formulaic solution is smoothly continuous, consisting of an infinite number of points on the interval shown. On the other hand, the graph based on the numerical solution consists of just a bare eight points, since the numerical method used apparently only found the value of the solution for x-increments of size 0.2.


Using Numerical Solutions

So what good is the numerical solution if it leaves out so much of the real answer? Well, we can respond to that question in several ways:

The numerical solution still looks like it is capturing the general trend of the "real" solution, as we can see when we look at the side-by-side graphs. This means that if we are seeking a qualitative view of the solution, we can still get it from the numerical solution, to some extent.

The numerical solution could even be "improved" by playing "join-the-dots" with the set of points it produces. In fact this is exactly what some solver packages, such as Mathematica, do do with these solutions. (Mathematica produces a join-the-dots function that it calls InterpolatingFunction.)

When actually using the solutions to differential equations, we often aren't so much concerned about the nature of the solution at all possible points. Think about it! Even when we are able to get formulaic solutions, a typical use we make of the formula is to substitute values of the independent variable into the formula in order to find the values of the solution at specific points. Did you hear that? Let me say it again: to find the values of the solution at specific
points. This is exactly what we can still do with a numerical solution

 

 

numerical_solutions.png

 

 

 

Solving an ordinary differential equation (ODE) or initial value problem means finding a clear expression for y in terms of a finite number of elementary functions of x. Euler’s method is one of the simplest method for the numerical solution of such equation or problem. This C program for Euler’s method considers an ordinary differential equations, and the initial values of x and y are known.

Mathematically, here, the curve of solution is approximated by a sequence of short lines i.e. by the tangent line in each interval. (Derivation) Using these information, the value of the value of ‘yn’ corresponding to the value of ‘xn‘ is to determined by dividing the length (xn – x) into n strips.
Therefore, strip width= (xn – x)/n and xn=x0+ nh. Again, if m be the slope of the curve at point, y1= y0 + m(x0 , yo)h.
Similarly, values of all the intermediate y can be found out.

Below is a source code forEuler’s method in C to solve the ordinary differential equation dy/dx = x+y. It asks for the value of of x0 , y0 ,xn and h. The value of slope at different points is calculated using the function ‘fun’.
The values of y are calculated in while loop which runs till the initial value of x is not equal to the final value. All the values of ‘y’ at corresponding ‘x’ are shown in the output screen. dy/dx = x+y

#include<stdio.h>
#include<math.h>
  
  
main()
{
                            
      float x;                                                                  /*defining variables*/
      float y;
      float h;
      float targetx;
        
       
        
      puts("This program will solve the differential equation y' = y - x \nusing Euler's Method with y(0)=1/2 \n\n");
      puts("Please enter the desired constant step size. (h-value)\n\n");
      scanf("%f", &h);                                                           /* Defining step size*/
      puts("\n\nNow enter the desired x-value to solve for y.\n\n");
      scanf("%f", &targetx);
        
      y = 0.5;
      x = 0.0;
        
      puts("\n\nX                Y");
        
      while ( x != targetx )
      {
        
      printf("\n\n%f     %f", x, y);
        
      y = y + ((y - x)*h);
        
      x= x+h;
      }
         
      printf("\n\n%f     %f\n", x, y);
        
      printf("\nThe value of y at the given x is %f.\n\n", y, h);
             
      system("pause");
        
}

euler_algorithm.png

 

here the solution is a set of points or a table of values that has certain underlying qualitative property which produced, this instantaneous rate of change ...

??

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.