Understanding Euler's Method - Sam Hart, 1997 - hart@physics.arizona.edu
------------------------------------------------------------------------
Euler's method, and the improved Euler's method are two ways by which
mathematicians approximate numerically an otherwise difficult to solve
differential equation (of which there are many.)
The basic premise is this; given a staring point (or initial values) one
will allow the variable to increment slightly, while moving in the
direction of the slope. At the new location, the slope will be checked
again, and the plot will travel in that direction during the next
variable increment. These procedures (of moving a little ways, checking
your slope [or compass, so to speak] and adjusting accordingly) will be
repeated a number of times, until an adequate result, location or
duration has been achieved.
Analytically, this can be represented like this; given a differential
equation,
y' = f(x,y)
with its solution containing the point (x0, y0), we shall find
approximate values for y = S f(x,y) dx. Because we can only take some
finite number of estimates, we will restrict ourselves to a range for x,
{x0 <= x <= b}.
We then try to approximate y at the points x1, x2, x3, x4, ... xb. We
see that the values of x increment by a particular value. Here we shall
call that value "h". Thus, x values increment like this,
x1 = x0 + h, x2 = x0 + 2h, .... xn = x0 + nh,
where n is some chosen number of subdivision of the interval from x0 to
b, each of the same length,
h = (b - x0) / n
In order to make our estimates, we approximate a segment of the graph of
y by a sequence of straight line segments, each with a slope equal to
the derivative at a point, or the value of the differential equation.
This is, in effect, taking a series of tangential lines to the original
curve (which, of course are tangential only in that they have the same
slope, because this is after all only an approximation.)
y1 = y0 + h f(x0,y0), for the first approximation
y2 = y1 + h f(x1,y1), for the second approximation.
In a more general form,
y = y + h (F (x , y ))
(k+1) k k k
As an example, let's take the solvable differential equation,
y' = xy, y(0) = 1
with the known solution,
2
(1/2)x
y = e
Taking h = 0.1, and over the interval 0 <= x <= 1, we get the following;
y1 = y0 + h (F(x0,y0)), 1 = 1 + 0.1 ( 0 * 1)
y2 = y1 + h (F(x1,y1)), 1.01 = 1 + 0.1 (0.1 * 1)
y3 = y2 + h (F(x2,y2)), 1.03 = 1.01 + 0.1 (0.2 * 1.01)
allowing us to make the following table;
Xk Yk (Estimated) True Value
0.0 1.0 1.0
0.1 1.0 1.005
0.2 1.01 1.020
0.3 1.03 1.046
0.4 1.06 1.083
0.5 1.10 1.133
0.6 1.16 1.197
0.7 1.23 1.277
0.8 1.31 1.377
0.9 1.42 1.499
1.0 1.55 1.647
As can be seen from the deviation between the true value of the function
and the estimated value, Euler's method leaves a little to be desired.
To improve the accuracy, a technique called "prediction-correction" is
utilized.
_Improved_Euler's_Method_
With Euler's method, we approximated a specific solution to a
differential equation using a tangential to the slope approach. This,
however, yielded errors that would propagate throughout any further
data. What we will do to correct this is to replace the slope in the
Euler approximation with the average of the original slope and the next
slope in the sequence. This average is given by
h ( F(x ,y ) + F(x ,u )) / 2
k k k+1 k+1
where
u = y + h( F(x , y ))
k+1 k k k
is the original Euler approximation. Thus, in a more general form, we
get
y = y + h ( F(x ,y ) + F(x ,u ))/2
k+1 k k k k+1 k+1
_Using_Euler's_Method_to_Find_Vector_Field_Flow_Lines_Numerically_
Often it is impossible to find formulas for the flow lines of a given
vector field. However, using Euler's method, we can approximate them
numerically. Because the flow lines
-> ^ ^
r(t) = x(t)i + y(t)j
of a vector field,
-> ->
v = F (x,y)
satisfy the differential equation,
-> -> ->
r(t) = F (r(t))
we can apply Euler's Method like this,
-> -> -> ->
r = r + h F (r )
k+1 k k
and use it in the same way as before to approximate the resulting flow
lines.