NUMERICAL METHODS FOR FIRST ORDER DIFFERENTIAL EQUATIONS 461
I
The approximation used with Euler’s method is to
take only the first two terms of Taylor’s series shown
in equation (1).
Hence ify 0 ,hand (y′) 0 are known,y 1 , which is an
approximate value for the function atQin Fig. 49.3,
can be calculated.
Euler’s method is demonstrated in the worked
problems following.
49.3 Worked problems on Euler’s
method
Problem 1. Obtain a numerical solution of the
differential equation
dy
dx
=3(1+x)−y
given the initial conditions thatx=1 wheny=4,
for the rangex= 1 .0tox= 2 .0 with intervals of
0.2. Draw the graph of the solution.
dy
dx
=y′=3(1+x)−y
Withx 0 =1 andy 0 =4, (y′) 0 =3(1+1)− 4 = 2.
By Euler’s method:
y 1 =y 0 +h(y′) 0 , from equation (2)
Hence y 1 = 4 +(0.2)(2)=4.4, sinceh= 0. 2
At pointQin Fig. 49.4,x 1 = 1 .2,y 1 = 4. 4
and (y′) 1 =3(1+x 1 )−y 1
i.e.(y′) 1 =3(1+ 1 .2)− 4. 4 =2.2
If the values ofx,yandy′found for pointQare
regarded as new starting values ofx 0 ,y 0 and (y′) 0 ,
the above process can be repeated and values found
for the pointRshown in Fig. 49.5.
Thus at pointR,
y 1 =y 0 +h(y′) 0 from equation (2)
= 4. 4 +(0.2)(2.2)=4.84
Whenx 1 = 1 .4 andy 1 = 4 .84,
(y′) 1 =3(1+ 1 .4)− 4. 84 =2.36
This step by step Euler’s method can be continued
and it is easiest to list the results in a table, as shown
0 x 0 = 1 x 1 =1.2 x
4
4.4
y
P
Q
y 0 y 1
h
Figure 49.4
0 1.0 x 0 =1.2 x 1 =1.4
h
x
y
P
Q
R
y 0 y 1
Figure 49.5
in Table 49.1. The results for lines 1 to 3 have been
produced above.
Table 49.1
x 0 y 0 (y′) 0
- 1 4 2
- 1.2 4.4 2.2
- 1.4 4.84 2.36
- 1.6 5.312 2.488
- 1.8 5.8096 2.5904
- 2.0 6.32768
For line 4, wherex 0 = 1 .6:
y 1 =y 0 +h(y′) 0
= 4. 84 +(0.2)(2.36)=5.312
and (y′) 0 =3(1+ 1 .6)− 5. 312 =2.488