462 DIFFERENTIAL EQUATIONS
For line 5,wherex 0 = 1 .8:
y 1 =y 0 +h(y′) 0
= 5. 312 +(0.2)(2.488)=5.8096
and (y′) 0 =3(1+ 1 .8)− 5. 8096 =2.5904
For line 6, wherex 0 = 2 .0:
y 1 =y 0 +h(y′) 0
= 5. 8096 +(0.2)(2.5904)
=6.32768
(As the range is 1.0 to 2.0 there is no need to calculate
(y′) 0 in line 6). The particular solution is given by the
value ofyagainstx.
A graph of the solution of
dy
dx
=3(1+x)−y
with initial conditionsx=1 andy=4 is shown in
Fig. 49.6.
1.0 1.2 1.4 1.6 1.8 2.0 x
5.0
6.0
y
4.0
Figure 49.6
In practice it is probably best to plot the graph as
each calculation is made, which checks that there is
a smooth progression and that no calculation errors
have occurred.
Problem 2. Use Euler’s method to obtain a
numerical solution of the differential equation
dy
dx
+y= 2 x, given the initial conditions that at
x=0,y=1, for the rangex=0(0.2)1.0. Draw
the graph of the solution in this range.
x=0(0.2)1.0 means thatxranges from 0 to 1.0 in
equal intervals of 0.2 (i.e.h= 0 .2 in Euler’s method).
dy
dx
+y= 2 x,
hence
dy
dx
= 2 x−y,i.e.y′= 2 x−y
If initiallyx 0 =0 andy 0 =1, then
(y′) 0 =2(0)− 1 =− 1.
Hence line 1 in Table 49.2 can be completed with
x=0,y=1 andy′(0)=−1.
Table 49.2
x 0 y 0 (y′) 0
- 0 1 − 1
- 0.2 0.8 −0.4
- 0.4 0.72 0.08
- 0.6 0.736 0.464
- 0.8 0.8288 0.7712
- 1.0 0.98304
For line 2, wherex 0 = 0 .2 andh= 0 .2:
y 1 =y 0 +h(y′), from equation (2)
= 1 +(0.2)(−1)=0.8
and (y′) 0 = 2 x 0 −y 0 =2(0.2)− 0. 8 =−0.4
For line 3, wherex 0 = 0 .4:
y 1 =y 0 +h(y′) 0
= 0. 8 +(0.2)(− 0 .4)=0.72
and (y′) 0 = 2 x 0 −y 0 =2(0.4)− 0. 72 =0.08
For line 4, wherex 0 = 0 .6:
y 1 =y 0 +h(y′) 0
= 0. 72 +(0.2)(0.08)=0.736
and (y′) 0 = 2 x 0 −y 0 =2(0.6)− 0. 736 =0.464
For line 5, wherex 0 = 0 .8:
y 1 =y 0 +h(y′) 0
= 0. 736 +(0.2)(0.464)=0.8288
and (y′) 0 = 2 x 0 −y 0 =2(0.8)− 0. 8288 =0.7712
For line 6, wherex 0 = 1 .0:
y 1 =y 0 +h(y′) 0
= 0. 8288 +(0.2)(0.7712)=0.98304
As the range is 0 to 1.0, (y′) 0 in line 6 is not needed.