You are on page 1of 5

1.

4 The Approximation Method of Euler

There are three general approaches to solving DEs. The analytical approach will be
the major focus of the course. We were introduced to a graphical approach in Section 1.3,
where we got information about solutions by sketching direction fields. In this lecture,
we study an example of a numerical approach. When analytic techniques fail, numerical
methods can produce an approximation that is “good enough”, provided that one under-
stands how to make the method as accurate as possible.

Consider the IVP


dy
= f (x, y), y(x0 ) = y0 .
dx

y
IVP: dy/dx=f(x,y), y(x 0)=y0

0 x

1
We can get a numerical solution to this problem by replacing

dy ∆y
with .
dx ∆x

Specifically, let h be a fixed positive number (called the step size), n a positive integer
(called the number of steps), and

xn = x0 + nh, yn = y(xn ), n = 1, 2, 3, ....

Then
y1 − y0
≈ f (x0 , y0 ).
x1 − x0

Hence, we can estimate y1 by

y1 ≈ y0 + hf (x0 , y0 ) := φ1 .

Similarly, we can approximate y2 by using the estimated value of y1 (i.e., φ1 ), that is

y2 ≈ y1 + hf (x1 , y1 ) ≈ φ1 + hf (x1 , φ1 ) := φ2 .

Repeating the process, we can get

yn ≈ φn−1 + hf (xn−1 , φn−1 ) := φn , n = 1, 2, 3, ....

Thus, we construct φ1 , ..., φn one by one to approximate the real solutions y1 , ..., yn ,
respectively. This approximation is called Euler’s method.

2
(ex.) Use Euler’s method with step size h = 1 to approximate the solution to the IVP

y 0 = y − x, y(0) = 2

at the points x = 1, 2, 3, 4.

This problem can actually be solved without resorting to numerical methods; it is linear
and we will see how to solve it in Chapter 2. The true solution turns out to be y = ex +x+1
(check this). Comparing to the true solution (see the figure below), we can see that the
numerical solution is not very accurate. The numerical solution gets worse and worse as
we move further to the right.

60

50 y=ex+x+1

40

30
y

20

10

0
0 0.5 1 1.5 2 2.5 3 3.5 4
x

The reason our numerical solution is so inaccurate is that our step size h = 1 is too large.
xn − x 0
Note that the step size h = . We actually can take more steps between 0 and 4
n

3
to reduce the step size. To improve the solution, we take 40 steps, which means step size
4−0
h= = 0.1. The approximate values are given below:
40

i 1 2 3 4 ······ 37 38 39 40

xi 0.1 0.2 0.3 0.4 ······ 3.7 3.8 3.9 4.0

φi 2.20 2.41 2.6 2.86 · · · · · · 38.70 42.20 46.04 50.26

We compare again the graphs of the numerical and true solution by using step size
h = 0.1. As you can see the figure below, it gets better now. However, the end point

60

50 y=ex+x+1

40

30
y

20

10
h=0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4
x

is (4, 50.26), which is still not as accurate as we would like. Remember, it is supposed
to be (4, 59.60) by the true solution. It seems obvious that the increased number of
points is responsible for the increased accuracy! To get even greater accuracy, therefore,
recalculate the solution a third time. This time we choose 400 steps between 0 and 4,
which indicates h = 0.01. The approximate values are listed in the following table

i 1 2 3 4 ······ 397 398 399 400

xi 0.01 0.02 0.03 0.04 · · · · · · 3.97 3.98 3.99 4.00

φi 2.02 2.04 2.60 2.08 · · · · · · 56.92 57.45 57.98 58.52

So, our new end point is (4, 58.52), which is much closer to the true result of (4, 59.60),
but it is still not very accurate (see the figure below). Clearly, if we want even greater
accuracy, we could ask the computer for even more steps.

4
60

50 y=ex+x+1

40

30

y
20

10
h=0.01
0
0 0.5 1 1.5 2 2.5 3 3.5 4
x

(ex.) Use Euler’s method to find approximations to the solution of the IVP

y 0 = x + y, y(1) = 0

at x = 5 by taking 1, 2, and 4 steps.

(HW) Textbook 1.4 Exercises: 1-7 odd

You might also like