Differential equations and numerical methods questions

8 replies · 2K views · last reply
awholenumber
Messages
200
Reaction score
10
i have few doubts about differential equations and numerical methods ...
in a differential equation question ... you are given an instantaneous rate of change...
and you are supposed to find the function that gives , this instantaneous rate of change

Numerical methods approximate the "instantaneous rate of change" with "the rate of change over a small interval".

Handwritten-style worked example on a web page: integrating dy/dx = x^2 - 3 to get y = x^3/3 - 3x + K, then Euler step calculations with x = 0, 0.01, 0.02, 0.03 and y values 1, 1.01, 1.0201, 1.030301.


is this same as ...

f(0)=1,
f(0.01)=1.01,
f(0.02)=1.0201,
f(0.03)= 1.030301

??
 
Yes. Note that replacing ##\ dy\over dx\ ## by ##\ \Delta y\over \Delta x\ ## is an approximation...
 
thanks ...

Worked solution showing dy/dx = x^2 - 3 rewritten as dy = (x^2 - 3)dx, integrated on both sides to give y = x^3/3 - 3x + K.


does anyone know how to re write this equation for numerical approximations ??
 
No approximation needed: you have solved the equation...
 
i am trying to understand some things in plain english ...
in a differential equation question,you are given an instantaneous rate of change of an object
The gradient of the curve dy/dx is the instantaneous change of y with respect to x ,the rate at which y is changing as x is changing
and you are supposed to find the function that gives , this instantaneous rate of change

Handwritten-style worked example in Euler's method: dy/dx = x^2 - 3 rearranged, integrated to y = x^3/3 - 3x + K, then step values y(0)=1, y(0.01)=1.01, y(0.02)=1.0201, y(0.03)=1.030301 computed with Δy = y·Δx.


and this is same as ...

f(0)=1,
f(0.01)=1.01,
f(0.02)=1.0201,
f(0.03)= 1.030301

??wasn't i supposed to find the function that gives ,this instantaneous rate of change ??
The answer is the function that has that rate of change
The answer is a function that has the instantaneous rate of change that you were given ...now i have four functions and four instantaneous rate of change ??
what does this mean ??
does it mean that i have four functions that has the instantaneous rate of change that i was given

??
 
You have two equations with a different character: one (##{dy\over dx}=x^2-3##) is of the type ## y'= f(x) ## and the other is of the type ##y'= f(y)## (I use the abbreviation ##y'## for the derivative ##{dy\over dx}## ).

## y'= f(x) ## is solved if you can find a primitive of f : a function ##F(x)## for which ##F'= f##.

There is the small matter of the integration constant: If you know your rate of change but you don't know where you start, then you can not determine where you will be next.

In other words: With every differential eqiuation you need something to deal with the integration constant (one for every "quote") . For example a function value at x = 0 (or a function value at any other point).

Your first equation isn't accompanied by such a condition, so you can't get further than ## y = F(x) = x^3/3-3x + K##.

Your second differential equation does have a condition: ##y(0) = 1##. You solve numerically by approaching y(0) as a linear function for a small step:$$y(0+\Delta x) \approx y(0) + \Delta x {dy\over dx}$$ when all you really know is $$ \lim_{h\downarrow 0} { y(0+h) - y(0) \over h } = {dy\over dx} \ .$$
When you take a few steps you get a sequence of approximated function values, but not a function (in the sense of an exact prescription what to do with x to get y).

So for ##\ y'= y\ \ \& \ \ y(0) = 1 \ ## you have found four function values, not four functions.
 
Last edited:
BvU said:
You have two equations with a different character: one (##{dy\over dx}=x^2-3##) is of the type ## y'= f(x) ## and the other is of the type ##y'= f(y)## (I use the abbreviation ##y'## for the derivative ##{dy\over dx}## ).

## y'= f(x) ## is solved if you can find a primitive of f : a function ##F(x)## for which ##F'= f##.

There is the small matter of the integration constant: If you know your rate of change but you don't know where you start, then you can not determine where you will be next.

In other words: With every differential eqiuation you need something to deal with the integration constant (one for every "quote") . For example a function value at x = 0 (or a function value at any other point).

Your first equation isn't accompanied by such a condition, so you can't get further than ## y = F(x) = x^3/3-3x + K##.

Your second differential equation does have a condition: ##y(0) = 1##. You solve numerically by approaching y(0) as a linear function for a small step:$$y(0+\Delta x) \approx y(0) + \Delta x {dy\over dx}$$ when all you really know is $$ \lim_{h\downarrow 0} { y(0+h) - y(0) \over h } = {dy\over dx} \ .$$
When you take a few steps you get a sequence of approximated function values, but not a function (in the sense of an exact prescription what to do with x to get y).

So for ##y'= y & y(0) = 1 ## you have found four function values, not four functions.

BvU ,

thanks a lot .. there is so much good information in that post ... i have already learned a lot from your post ... now i think its just a matter of googling the proper words from your post ..
even differential equation is kind of getting interesting ...

few more basic questions ...

i don't understand this properly ...

most of the time , the original question is ...

find the function that gives ,this instantaneous rate of change
Handwritten-style typed derivation: dy/dx = x^2 - 3 rewritten as dy = (x^2 - 3)dx, integrated to y = x^3/3 - 3x + K, then a worked Euler step table for y' = y with y(0)=1 and dx = 0.01 giving y(0.01)=1.01, y(0.02)=1.0201, y(0.03)=1.030301.


which is same as this ..

f(0)=1,
f(0.01)=1.01,
f(0.02)=1.0201,
f(0.03)= 1.030301

for ##y'= y & y(0) = 1 ## you have found four function values, not four functions.

what is the next thing you do with these function values... you plug it into the equations ??

i really thought the answer is a function ..that has that rate of change

i mean this is how a question really starts ...

find the function that gives ,this instantaneous rate of change

<Mod note: Irrelevant image deleted>if answer is a function that has that rate of change ...

what are these four function values ...

?
 
Last edited by a moderator:
Nice picture; taken from inside the book ? (I recognize Rotterdam, though...)

Seems to me you still have trouble understanding what you did for ##y'=y## so let's step back and treat ##y'= x^2-3## the same way. Add initial condition y(0) = 0 so it yields a unique solution.

##x = 0 \rightarrow y(0) = 0##

##x = 0.1 \rightarrow y(0.1) = 0 + (0.01 - 3)* 0.1 = -0.299 \ ## exact solution ##y(0.1) = 0.001 - 3 = -0.299 \ ## hurray.

etc. etc. we get:
Table comparing numerical and exact solutions of y' = x^2 - 3 with y(0) = 0 for x from 0 to 1 in steps of 0.1, with columns for x, numerical approach, exact solution and error.


Line graph of a numerical approximation (blue dots) and exact solution (red curve) decreasing from 0 to about -2.6 over x from 0 to 1, with error (purple triangles) rising slightly above zero.


So the exact solution is a function ##y = x^3/3-3x## and the numerical approach is a table of aproximated function values.

(I took steps of 0.1 so the difference between exact and numerical becomes visible).

In fact, for your other equation ##y'=y## and ##y(0)=1## an exact solution can also be found. Use the same method (everything with y on one side gives ##{dy\over y}=dx##, then integrate and apply the initial condition). But you'll learn that one soon enough.
 
Attachments
  • Line graph with three curves over x from 0 to 1.2: a blue numerical approach curve and a red exact solution curve both falling to about -2.6 and -2.0, and a purple error curve rising from 0 to about 0.6.
    upload_2016-7-22_16-22-7.png
    4.1 KB · Views: 635
let me re arrange a few things ...so that i can understand this properly ...ok , there are two questions in this one ...

find the function that gives, this instantaneous rate of change ...
Handwritten-style worked example from a numerical methods text: separation of variables for dy/dx = x^2 - 3 giving y = x^3/3 - 3x + K, followed by Euler steps for y' = y with y(0) = 1, step size 0.01.
which is same as this ..

f(0)=1,
f(0.01)=1.01,
f(0.02)=1.0201,
f(0.03)= 1.030301
BvU said:
You have two equations with a different character: one (##{dy\over dx}=x^2-3##) is of the type ## y'= f(x) ## and the other is of the type ##y'= f(y)## (I use the abbreviation ##y'## for the derivative ##{dy\over dx}## ).

## y'= f(x) ## is solved if you can find a primitive of f : a function ##F(x)## for which ##F'= f##.

There is the small matter of the integration constant: If you know your rate of change but you don't know where you start, then you can not determine where you will be next.

In other words: With every differential eqiuation you need something to deal with the integration constant (one for every "quote") . For example a function value at x = 0 (or a function value at any other point).

Your first equation isn't accompanied by such a condition, so you can't get further than ## y = F(x) = x^3/3-3x + K##.

Your second differential equation does have a condition: ##y(0) = 1##. You solve numerically by approaching y(0) as a linear function for a small step:$$y(0+\Delta x) \approx y(0) + \Delta x {dy\over dx}$$ when all you really know is $$ \lim_{h\downarrow 0} { y(0+h) - y(0) \over h } = {dy\over dx} \ .$$
When you take a few steps you get a sequence of approximated function values, but not a function (in the sense of an exact prescription what to do with x to get y).

So for ##\ y'= y\ \ \& \ \ y(0) = 1 \ ## you have found four function values, not four functions.

for ##y'= y & y(0) = 1 ## you have found four function values, not four functions.

for ##f(x)=y & f(0) = 1 ## you have found four function values, not four functions.

f(0)=1,
f(0.01)=1.01,
f(0.02)=1.0201,
f(0.03)= 1.030301

BvU said:
Seems to me you still have trouble understanding what you did for ##y'=y## so let's step back and treat ##y'= x^2-3## the same way. Add initial condition y(0) = 0 so it yields a unique solution.

##x = 0 \rightarrow y(0) = 0##

##x = 0.1 \rightarrow y(0.1) = 0 + (0.01 - 3)* 0.1 = -0.299 \ ## exact solution ##y(0.1) = 0.001 - 3 = -0.299 \ ## hurray.

etc. etc. we get:
View attachment 103655

View attachment 103661

So the exact solution is a function ##y = x^3/3-3x## and the numerical approach is a table of aproximated function values.

(I took steps of 0.1 so the difference between exact and numerical becomes visible).

In fact, for your other equation ##y'=y## and ##y(0)=1## an exact solution can also be found. Use the same method (everything with y on one side gives ##{dy\over y}=dx##, then integrate and apply the initial condition). But you'll learn that one soon enough.

BvU ,

thanks for the reply ...

its from a book called "numerical methods for ordinary differential equations " ...i did a horizontal flip of that image with ms paint ..
Mod note: Why? How does that add any information to your question? Also, you have posted an image of a bridge twice, which also adds nothing of substance to what you're asking.
few more re arrangements in a way that i can understand this ...

Seems to me you still have trouble understanding what you did for ##f(x)=y## so let's step back and treat ##f(x)= x^2-3## the same way. Add initial condition f(0) = 0 so it yields a unique solution.

##x = 0 \rightarrow f(0) = 0##

##x = 0.1 \rightarrow f(0.1) = 0 + (0.01 - 3)* 0.1 = -0.299 \ ## exact solution ##f(0.1) = 0.001 - 3 = -0.299 \ ##

etc .. etc .. we get ..

Spreadsheet table comparing a numerical approach and exact solution at x from 0 to 1 in steps of 0.1, with columns for numerical value, exact value and error.


Graph of numerical approach, exact solution and error against x from 0 to 1.2; the exact solution is a red curve falling from 0 to -2 at x = 1, numerical approximations are blue dots drifting below it, and error points are purple triangles rising from 0 to about 0.6.


So the exact solution is a function ##f(x) = x^3/3-3x## and the numerical approach is a table of aproximated function values.

(I took steps of 0.1 so the difference between exact and numerical becomes visible).

In fact, for your other equation ##f(x)=y## and ##f(0)=1## an exact solution can also be found. Use the same method (everything with y on one side gives ##{dy\over y}=dx##, then integrate and apply the initial condition). But you'll learn that one soon enough

Line graph with x-axis from 0 to 1.2 and y-axis from -3.000 to 1.000. Three curves: Numerical approach (blue) and Exact solution (red) both decrease to about -2.6 and -2.0 at x = 1; Error (purple) rises from 0 to about 0.6.
i am going to take a little bit of time to read and re read this ...

there is so much good information again on this one ...

let me see what i can learn from this , and i don't know where to move to from here ...

again , thanks a lot ...

if i have more doubts i will come back and post more ...
 
Last edited by a moderator: