Numerical methods for first order differential equations 467
corrected value,yC 1 in the improved Euler method is
given by:
yC 1 =y 0 +^12 h[(y′) 0 +f(x 1 ,yP 1 )] (4)The following worked problems demonstrate how
equations (3) and (4) are used in the Euler-Cauchy
method.
Problem 4. Apply the Euler-Cauchy method to
solve the differential equation
dy
dx=y−xin the range 0(0.1)0.5, given the initial conditions
that atx=0,y=2.dy
dx=y′=y−xSince the initial conditions are x 0 =0andy 0 = 2
then (y′) 0 = 2 − 0 =2. Interval h= 0 .1, hence
x 1 =x 0 +h= 0 + 0. 1 = 0 .1.
From equation (3),
yP 1 =y 0 +h(y′) 0 = 2 +( 0. 1 )( 2 )= 2. 2From equation (4),
yC 1 =y 0 +^12 h[(y′) 0 +f(x 1 ,yP 1 )]=y 0 +^12 h[(y′) 0 +(yP 1 −x 1 )],in this case= 2 +^12 ( 0. 1 )[2+( 2. 2 − 0. 1 )]=2.205(y′) 1 =yC 1 −x 1 = 2. 205 − 0. 1 = 2. 105If we produce a table of values, as in Euler’s method,
we have so far determined lines 1 and 2 of Table 49.8.
The results in line 2 are now taken asx 0 ,y 0 and(y′) 0
for the next interval and the process is repeated.
Table 49.8
x y y′- 0 2 2
- 0.1 2.205 2.105
- 0.2 2.421025 2.221025
- 0.3 2.649232625 2.349232625
- 0.4 2.89090205 2.49090205
- 0.5 3.147446765
For line 3,x 1 = 0. 2
yP 1 =y 0 +h(y′) 0 = 2. 205 +( 0. 1 )( 2. 105 )= 2. 4155yC 1 =y 0 +^12 h[(y′) 0 +f(x 1 ,yP 1 )]= 2. 205 +^12 ( 0. 1 )[2. 105 +( 2. 4155 − 0. 2 )]=2.421025(y′) 0 =yC 1 −x 1 = 2. 421025 − 0. 2 = 2. 221025For line 4,x 1 = 0. 3
yP 1 =y 0 +h(y′) 0= 2. 421025 +( 0. 1 )( 2. 221025 )= 2. 6431275yC 1 =y 0 +^12 h[(y′) 0 +f(x 1 ,yP 1 )]= 2. 421025 +^12 ( 0. 1 )[2. 221025+( 2. 6431275 − 0. 3 )]=2.649232625(y′) 0 =yC 1 −x 1 = 2. 649232625 − 0. 3= 2. 349232625
For line 5,x 1 = 0. 4
yP 1 =y 0 +h(y′) 0= 2. 649232625 +( 0. 1 )( 2. 349232625 )= 2. 884155887yC 1 =y 0 +^12 h[(y′) 0 +f(x 1 ,yP 1 )]= 2. 649232625 +^12 ( 0. 1 )[2. 349232625+( 2. 884155887 − 0. 4 )]=2.89090205(y′) 0 =yC 1 −x 1 = 2. 89090205 − 0. 4= 2. 49090205For line 6,x 1 = 0. 5yP 1 =y 0 +h(y′) 0= 2. 89090205 +( 0. 1 )( 2. 49090205 )= 3. 139992255