7.7 MILNE’S PREDICTOR-CORRECTOR METHODPredictor-Corrector Methods Predictor-Corrector formulae are easily derived but require the previous evaluation of y and y = f x y at a certain nu
Trang 1k4 =hf x( 0+h y, 0+k3) =0.2 0 0.2 1 0.0198( + )( − )=0.039208
1
6
y =y + k + k + k +k
= +1 10 2+ −( 0.02) (+ −2 0.0198) (+ −0.039208)
6
=1.0000 0.198013−
= 0.9801986 ≅ 0.9802
The exact value of y(0.2) is 0.9802.
Example 3 Solve the equation y′ = +(x y)with y 0 = 1 by Runge-Kutta rule from x = 0 to x = 0.4 with h = 0.1.
Sol Here f x y( ), = +x y h, =0.1, given y0 =1 when x0 =0
We have,
k1=hf x y( 0, 0) =0.1 0 1( + =) 0.1
2 0 , 0 1
k h
k =hf x + y +
=0.1 0.05 1.05( + ) =0.11
3 0 , 0 2
k h
k =hf x + y +
=0.1 0.05 1.055( + ) =0.1105
k4 =hf x( 0+h y, 0+k3) =0.1 0.1 1.1105( + ) =0.12105
1 ( 0.1 ) 0 ( 1 2 3 4)
1
6
x
y =y = =y + k + k + k +k
1 1(0.1 0.22 0.2210 0.12105)
6
Similarly for finding y2=y x( =0.2), we get
k1=hf x y( 1 1=0.1)( )0.1 +1.11034=0.121034
2 1 , 1 1
k h
k =hf x + y +
=0.1 0.15 1.11034 0.660517[ + + ]=0.13208
3 1 , 1 2
k h
k =hf x + y +
=0.1 0.15 1.11034 0.06604[ + + ]=0.13208
Trang 2k4 =hf x( 1+h y, 1+k3) =0.1 0.20 1.11034 0.13263[ + + ]=0.14263
1
6
x
y =y = =y + k + k + k +k
1.11034 1 0.121034 2 0.13208 0.13263 0.14429( ) 1.2428
6
Similarly, for finding y3 =y x( =0.3), we get
k1 =hf x y( 2 2)=0.1 0.2( )+1.2428=0.14428
2 2 , 2 1
k h
k =hf x + y +
=0.1 0.25 132428 0.07214[ + + ]=0.15649
3 2 , 2 2
k h
k =hf x + y +
=0.1 0.25 1.2428 0.07824[ + + ]=0.15710
k4 =hf x( 2+h y, 2+k3) =0.1 0.30 1.2428 0.15710[ + + ]=0.16999
1
6
x
y =y = =y + k + K + K +k
=0.13997 Similarly, for finding y4 =y x( =0.4), we get
k1 =( )[0.1 0.3 1.3997+ ]=0.16997 ⇒ k1=0.16997
k2=( )[0.1 0.35 1.3997 0.08949+ + ]=0.18347 ⇒ k2 =0.18347
k3 =( )[0.1 0.35 1.3997 0.9170+ + ]=0.18414 ⇒ k3 =0.18414
k4 =( )[0.1 0.4 1.3997 0.18414+ + ]=0.19838 ⇒ k1=0.19838
∴ 4 1.3997 1 0.16997 2 0.18347 0.18414 0.19838( )
6
y4=1.5836 Ans
Example 4 Given dy y x
dx= − with y(0) = 2, find y(0.1) and y(0.2) correct to 4 decimal places.
Sol We have x0=0, y0=2, h=0.1
Then, we get
k1=hf x y( 0, 0) =0.1 2 0( − )=0.2
Trang 32 0 , 0 1
k h
k =hf x + y +
=0.1 2 +0.22 − +0 0.12 =0.205
3 0 , 0 2
k h
k =hf x + y +
=0.1 2 +0.2052 −0+0.12 =0.20525
k4=hf x( 0+h y, 0+k3) =0.1 2 0.20525 (0 0.1)[ + − + ]=0.210525 Therefore,
0 [ 1 2 3 4]
1
6
y=y + k + k + k +k
= +2 0.2051708=2.2051708
⇒ y( )0.1 =2.2052 Corect to 4 decimal places
For y( )0.2 , we have x0 =0.1, y0 =2.2052, we get
k1=hf x y( 0, 0) =0.1 2.2052 0.1( − )=0.21052
2 0 , 0 1
k h
k =hf x + y +
=0.1 2.2052 +0.210522 −0.1+0.12 =0.216046
3 0 , 0 2
k h
k =hf x + y +
=0.1 2.2052 +0.2160462 −0.1+0.12 =0.2163223
k4=hf x( 0+h y, 0+k3) =0.1 2.2052 0.2163223 + −(0.1 0.1+ )=0.22215223
1
6
y = + k + k + k +k
=2.2052 0.2162348+
=2.4214 Ans
Example 5 Solve dy 2xy2
dx= − with y(0) = 1 and h = 0.2 on the interval [0.1] using Runge-Kutta
fourth order method.
Trang 4Sol As per given, we have x0=0, y0=1, h=0.2
k1=hf x y( 0, 0) ( )( )( )2
2 0.2 0 1 0
k h
k =hf x + y +
( ) 0.2 ( )2
2
k h
k =hf x + y +
( ) 0.2 ( )2
2 0.2 0.98 0.38416
2
k4 =hf x( 0+h y, 0+k3) = −22 0.2 0.2 0.961584( )( )( )2= −0.0739715 Hence,
( ) 0 [ 1 2 3 4]
1
6
y =y + k + k + k +k
1 1[0 0.08 0.076832 0.0739715] 6
=0.9615328 Now, we have
x1=0.2,y1 =0.9615328,h=0.2, we get
k1 =hf x y( 1, 1) ( )( )( )2
2 0.2 0.2 0.9615328 0.0739636
k h
k =hf x + y +
= − ( )( )( )2 =
2 0.2 0.3 0.924551 0.1025754
k h
k =hf x + y +
= – 2(0.2)(0.3)(0.9102451)2 = 0.0994255
k4 = hf(x1 + h, y1 + k3)
( )( )( )2
2 0.2 0.4 0.8621073 0.1189166
Thus, ( )= + + + +
1
6
0.9615328 1[ 0.0739636 0.2051508 0.1988510 0.1189166]
6
=0.8620525
Trang 5Similarly, we can obtained
y( )0.6 =0.7352784
y( )0.8 =0.6097519
y( )1.0 =0.500073 Ans
Example 6 Solve dy yz x,
dx= + dz =xz y+ ;
dx Given that y(0) = 1, z(0) = –1 for y(0.1), z(0.1).
Sol Here, f x y z1( , , )=yz x+
= +
2( , , )
f x y z xz y
h=0.1,x0=0,y0=1,z0= −1
k1=hf x y z1( 0, 0, 0) (=h y z0 0+x0)= −0.1
l1=hf x y z2( 0, 0, 0) (=h x z0 0+y0)=0.1
2 1 0 , 0 1, 0 1
h
k =hf x + y + z +
=hf1(0.05, 0.95, 0.95− )= −0.08525
2 2 0 , 0 1, 0 1
h
l =hf x + y + z +
=hf2(0.05, 0.95, 0.95)− = −0.09025
3 1 0 , 0 2, 0 2
h
k =hf x + y + z +
=hf1(0.05, 0.957375, 0.954875− )= −0.0864173
3 2 0 , 0 2, 0 2
h
l =hf x + y + z +
=hf2(0.05, 0.957375, 0.954875− = −0.0864173
k4 = hf1(x0 + h,y0 + h3, z0 + l3) = –0.073048
l4 = hf2(x0 + h, y0 + h3, z0 + l3) = + 0.0822679
=1( 1+2 2+2 3+ 4)= −0.0860637
6
k k k k k
(1 2 3 4)
1
2 2 0.0907823 6
l= l + l + l +l =
y1=y( )0.1 =y0+ = −k 1 0.0860637=0.9139363
z1=z( )0.1 =z0+ = − +k 1 0.0907823= −0.9092176
Trang 67.7 MILNE’S PREDICTOR-CORRECTOR METHOD
Predictor-Corrector Methods
Predictor-Corrector formulae are easily derived but require the previous evaluation of y and
( )
y = f x y at a certain number of evenly spaced pivotal point (discrete points of x1 of
x-axis) in the neighbourhood of x0
In general the Predictor-Corrector methods are the methods which require the values of
y at x x n, n−1,x n−2 For computing the value of y at x n+1 A Predictor formula is used to
predict the value of y n+1 Now we discuss Milne’s method which is known as Predictor-Corrector methods
Milne’s Method
The method is a simple and eresonable accurate method of solving the ordinary first order differential equation numerically To solve the differential equation
dy y f x y( ),
dx= =′
by this method we first obtain the approximate value of y n+1 by Predictor formula and then improve the value of y n+1by means of a corrector formula Both these formulas can be derived from the Newton forward interpolation formula as follows:
From Newton’s formula, we have
( )= ( + )= ( )+ ∆ ( )+ ( − )∆ ( )
1
1 2
u u
f x f x uh f x u f x f x
( ) 3 0
( 1)( 2)
1 2 3
u u u
f x
where u x x0,
h
−
= or x=x0+uh
Putting y′ = f x( ) and y0′ = f x( )0 in the above formula, we get
y′=y′+ ∆ +u y′ − ∆ y′+ − − ∆ y′+ − − − ∆ y′
Intergrating (2) from x0 to x0+4h i.e from u=0 to u=4, we get
0 4 0
0
h
x
x
4 0
( 1)( 2)( 3)
] 24
(3 hdu = dx) which gives
0 0
4
x
x h
y + −y =h h′+ ∆ +y′ ∆ y′+ ∆ y′+ ∆ y′
[considering upto fourth differences only]
Using ∆ = −E 1, we get
y −y =h y′+ E− y′+ E− y′+ E− y′+ ∆ y′
Trang 7⇒ [ ] 2
h
This is known as Milne’s predictor formula The corrector formula is obtained by integrating
(2) from x0 to x0 + 2h i.e., from u = 0 to u = 2.
x x h ydx
0
0 + 2
2
⇒ y2 – y0 = h y2 2 y 1 y y
3
1 90
0′ + 0′ + 2 0′ 4 0′
L
Using ∆ = −E 1, and simplifying we get
Expression (4) is called Milne’s corrector formula
The general forms of equations (3) and (4) are
4
3
h
3
h
4
3
n
h
and 1 1 [ 1 4 1]
3
h
In terms of f the Predictor formula is
1
4
3
n
h
and the corrector formula is
3
h
Example 7 Tabulate by Milne’s method the numerical solution of dy x y
dx= + with initial conditions
x 0 = 0, y 0 = 1, from x = 0.20 to x = 0.30.
Sol Here y′ = +x y
y′′= +1 y y′ ′′′, =y y′′ ′′′′, =y′′′ ′′′′′,y =y′′′′,
Hence, y0′ =x0+y0 = + =0 1 1
y0′′= + + = + =1 y0′ 1 1 2
y0′′′=y0′′ =2
y′′′′= y′′′′′=
Now taking h=0.05, we get
y1 =1.1026, y2=1.2104, y3 =1.3237
Trang 8Using Milne’s Predictor formula, we get
4
3
h
y =y + y′−y′+ y′
4 0.05
1 2.2052 1.2104 2.6474 1.2428 3
4 0.2 1.2428 1.4428
Using corrector formula, we get
3
h
y =y + y′+ y′ +y′
1.1104 1.2104 5.2948 1.4428
3
which is the same as the predicted value
∴ y4=y0.20 =1.2428
and y4′ =1.4428
and putting n = 4, h = 0.05, we get
4
3
h
y =y + y′−y′+ y′
4(0.05) 1.0526 2.4208 1.3237 2.8856
3
5 5 5 0.25 1.3181 1.5681
y′ =x +y = + = Using Milne’s corrector formula, we get
5
3
h
y =y + y′+ y′ +y′
1.1737 1.3237 5.7712 1.5681
3
which is the same as the predicted value
∴ y5=y0.25=1.3181
and y5′ =1.5681
Again putting n=5, h=0.05 and using Milne’s predictor formula, we get
4
3
h
y =y + y′−y′ + y′
4 0.05 1.1104 2.6474 1.4428 3.1362
3
y′ =6 0.3 1.39972 1.6997+ =
which is corrected by
3
h
y =y + y′+ y′ +y′
1.2428 1.4428 6.2724 1.6997 1.3997
3
Trang 9which is same as the predicted value.
∴ y6 =y0.30=1.3997
and y′ =6 1.6997
The result can be put in the tabular form
Example 8 Compute y(2) if y(x) is the solution of dy 1( )
= x + y
dx 2 using Milne Predictor-corrector method Given y 0 = 2, y 0.5 = 2.6336, y 1.0 = 3.595, y 1.5 = 4.968.( ) ( ) ( ) ( )
Sol Here, we have
x = y = 0 ( )
1
0 2 1 2
1 0.5, 1 2.636
1 0.5 2.636 1.568 2
2 1, 2 3.595
1
1 3.595 2.2975 2
3 1.5, 3 4.968
1 1.5 4.968 3.234 2
Using Predictor formula, we get
y4 = y0 + 4
3
h (2f1 – f2 + 2f3) = 2.0 + 4 0 5
3
× (2 × 1.568 – 2.2975 + 2 × 3.234) =6.871 and 4 4 4 ( )
1
2 6.871 4.4335 2
f =x +y = + =
Using corrector formula, we get
4 2 [ 2 4 3 4]
3
h
y =y + f + f +f
3.595 0.5(2.2975 4 3.234 4.4355)
3
=6.873166≈ 6.8732 Thus, corrected 4 1( 4 4) 1( )
2.0 6.8732 4.4366
Again, using Corrector formula, we get
4 2 ( 2 4 3 4)
3
h
y =y + f + f +f
3.595 0.5(2.2975 4 3.234 4.4366)
3
=6.87335 6.8734≈
Trang 10Example 9 The differential equation dy dx = 1 + y 2 satisfies the following sets of values of x and y.
Sol Firstly, we calculate the following
f0= 1 + y02 = 1
f1= 1 + y12 = 1.0411
f2= 1 + y22 = 1.1787
f3= 1 + y32 = 1.4681 Using Predictor formula, we get
4= 0+4 (2 1− 2+2 3)
3
h
y y f f f
0 4 0.2 2 1.0411( ) 1.1787 2 1.4681( )
3
×
⇒ = + 2 = +( )2 =
4 1 4 1 1.0239 2.0480
Using Corrector formula, we have
4 2 [ 2 4 3 4]
3
h
y =y + f + f +f
0.4228 0.2(1.1787 4 1.4681 2.0480)
3
⇒ y( )0.8 =1.0294
The corrected value of
f4= +1 y24 =2.0597 Now, to find f( )1 we use predictor formula such that
y5 = y1 + 4
3
h (2f1 – f3 + 2f4)
= 0.2027 + 4 0 2
3
×
[2(1.1787) – 1.4681 + 2(2.0597)] = 1.5384 and f5 = 1 + y52 = 1 + (1.5384)2 = 3.3667
Finally using corrector formula, we get
5 3 [ 3 4 4 5]
3
h
y =y + f + f +f
0.2( ( ) )
0.6841 1.4681 4 2.0597 3.3667
3
=1.5556733 1.5557=