Jan-19-2021, 12:52 PM
(This post was last modified: Jan-19-2021, 12:52 PM by Serafim.
Edit Reason: Corrected my english, some typos and the english terminology
)
One step to a solution is understanding the Euler method.
The idea is to numerically calculate a decent approximation of something that otherwise can be quite difficult. You want to approximate as closely as possible the function f by only knowing the relation between the function and its first derivative. You have a starting point, in this case 0 and an end point (here 2). The idea is that this is enough if you can find an accurate point on the function close to the starting point in order to approximate the slope of the curve with that of a secant and thus be able to find another point of the curve. Then use that point to recalculate the slope in that point and so on until you reach the endpoint.
(The image is just to show the idea, it is not closely related to the function in the given problem).
It is obvious that the approximation gets better if h is very small. Euler showed that if it is small enough then you can stepwise approximate the derivative and thus the whole function (and in many cases find the function f very accurately, especially in the case of first order differential equations). In the current case I think that the problem is a suitable introductionary problem to illustrate the Euler method.
The normal case for the Euler method is in general terms (I use "g" to avoid confusion with the given problem. I could use any letter to denote "some function")
y' = g(x,y)
Translated to the given problem it gives us
f'(t) = g(t, f(t)) => f'(t) = 4 + 3*f(t)
As there is no other dependency on "t" apart from "f(t)", which is replaced by a stepwise calculated constant the rule becomes quite simple when we translate it into the Euler formula
yn+1 = yn + f'(yn) * (tn+1 - tn)
which gives us
f(t1) = f(t0) + (4 + 3*f(t0)) * h
The start values are given: t0 = 0 and f(t0) = 0 (implicitly from the interval given as t ∈ [0,2] and f(0) = 0. Use 10 000 steps tells us that h = 2 / 9999 = 0.00020002...
Take two steps (to test it, I approximate h to 0.0002):
f[0] = 0
f[1] = f[0] + derived_f(f[0]) * h = 0 + derived_f(0) * 0.0002 = 0 + 4 * 0.0002 = 0.0008
f[2] = 0.0008 + derived_f(0.0008) * h = 0.0008 + (4 + 3 * 0.0008) * 0.0002 = 0.00160048
...
So, the absence of t in f'(t) simplifies the problem and only one parameter is needed in "derived_f" ("df" would be a better name in my opinion).
The idea is to numerically calculate a decent approximation of something that otherwise can be quite difficult. You want to approximate as closely as possible the function f by only knowing the relation between the function and its first derivative. You have a starting point, in this case 0 and an end point (here 2). The idea is that this is enough if you can find an accurate point on the function close to the starting point in order to approximate the slope of the curve with that of a secant and thus be able to find another point of the curve. Then use that point to recalculate the slope in that point and so on until you reach the endpoint.
(The image is just to show the idea, it is not closely related to the function in the given problem).
It is obvious that the approximation gets better if h is very small. Euler showed that if it is small enough then you can stepwise approximate the derivative and thus the whole function (and in many cases find the function f very accurately, especially in the case of first order differential equations). In the current case I think that the problem is a suitable introductionary problem to illustrate the Euler method.
The normal case for the Euler method is in general terms (I use "g" to avoid confusion with the given problem. I could use any letter to denote "some function")
y' = g(x,y)
Translated to the given problem it gives us
f'(t) = g(t, f(t)) => f'(t) = 4 + 3*f(t)
As there is no other dependency on "t" apart from "f(t)", which is replaced by a stepwise calculated constant the rule becomes quite simple when we translate it into the Euler formula
yn+1 = yn + f'(yn) * (tn+1 - tn)
which gives us
f(t1) = f(t0) + (4 + 3*f(t0)) * h
The start values are given: t0 = 0 and f(t0) = 0 (implicitly from the interval given as t ∈ [0,2] and f(0) = 0. Use 10 000 steps tells us that h = 2 / 9999 = 0.00020002...
Take two steps (to test it, I approximate h to 0.0002):
f[0] = 0
f[1] = f[0] + derived_f(f[0]) * h = 0 + derived_f(0) * 0.0002 = 0 + 4 * 0.0002 = 0.0008
f[2] = 0.0008 + derived_f(0.0008) * h = 0.0008 + (4 + 3 * 0.0008) * 0.0002 = 0.00160048
...
So, the absence of t in f'(t) simplifies the problem and only one parameter is needed in "derived_f" ("df" would be a better name in my opinion).