Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

MODULE-4

Numerical Solutions of Ordinary Differential Equations

Numerical solution of ordinary differential equations of first order and first


degree: Taylor’s series method, Modified Euler’s method, Runge-Kutta method
of fourth order. Milne’s and Adams-Bashforth predictor and corrector methods
[ No derivation of formulae]

Numerical solution of a Differential Equation


𝑑𝑦
Consider the first order and first degree differential equation = 𝑓(𝑥𝑦) with the
𝑑𝑥
initial condition y(x0)=y0 and x=x0 called initial value problem
We discuss the following numerical methods for solving an intial value problem
1. Taylor’s series method
2. Modified Euler’s method
3. Runge-Kutta method of order IV
4. Milne’s predictor –corrector method
5. Adams-Bash forth predictor –corrector method

Taylor’s series method


𝑑𝑦
Consider the first order and first degree differential equation = 𝑓(𝑥𝑦) with the initial
𝑑𝑥
condition y(x0)=y0
Taylor’s series expansion of y(x) in powers of (x-x0) is

( x  0) / ( x  0) 2 // ( x  0) 3 /// ( x  0) 4 / V
y( x)  y(0)  y (0)  y (0)  y (0)  y (0)  
1! 2! 3! 4!

Problems:

1. Find by Taylor’s series method the value of y at x = 0.1 and 0.2 five places of decimals for the
dy
IVP  x 2 y  1, y ( 0)  1 .
dx

Soln:

Given x0  0, y 0  1 and f ( x, y )  x y  1
2

Taylor’s series expansion about the point x  0( x0 ) is


( x  0) / ( x  0) 2 // ( x  0) 3 /// ( x  0) 4 / V
y( x)  y(0)  y (0)  y (0)  y (0)  y (0)  
1! 2! 3! 4!
x 2 // x 3 /// x 4 /V
i.e. y( x)  y(0)  xy / (0)  y (0)  y (0)  y (0)   (1)
2 6 24

It is given that y(0)  1


dy
 y / ( x)  x 2 y  1  y / (0)  1
dx

Differentiating y ( x)  x y  1 successively three times and putting x = 0 & y = 1, we get


/ 2

y // ( x)  2 xy  x 2 y /  y // (0)  0

y /// ( x)  2 y  4 xy /  x 2 y //  y /// (0)  2

y iv ( x)  6 y /  6 xy //  x 2 y ///  y iv (0)  6

/ // /// iv
Putting the values of y (0), y (0), y (0), y (0), y (0) in (1), we get

x2 x3 x4
y( x)  1  x(1)  (0)  (2)  (6)
2 6 24
x3 x4
y ( x)  1  x  
3 4
Hence y(0.1) = 0.90033 and y(0.2) = 0.80227.

2. Employ Taylor’s series method to obtain approximate value of y at x = 0.1 and 0.2 for the
dy
differential equation  2 y  3e x , y (0)  0. Compare the numerical solution obtained with the
dx
exact solution.

Soln:
Given x 0  0, y 0  0 and f ( x, y )  2 y  3e
x

Taylor’s series expansion about the point x  0 is


x 2 // x 3 /// x 4 /V
y( x)  y(0)  xy / (0)  y (0)  y (0)  y (0)   (2)
2 6 24

It is given that y(0)  0


dy
 y / ( x)  2 y  3e x  y / (0)  2 y(0)  3e 0  3
dx

Differentiating y ( x)  2 y  3e successively three times and putting x = y = 0, we get


/ x
y // ( x)  2 y /  3e x  y // (0)  2 y / (0)  3  9

y /// ( x)  2 y //  3e x  y /// (0)  2 y // (0)  3  21

y iv ( x)  2 y ///  3e x  y iv (0)  2 y /// (0)  3  45

/ // /// iv
Putting the values of y (0), y (0), y (0), y (0), y (0) in (2), we get
9 21 45 4
y ( x)  0  3x  x 2  x 3  x
2 6 24
9 7 15
 3x  x 2  x 3  x 4
2 2 8
Hence,

y(0.1) = 3(0.1)+4.5(0.1)2+3.5(0.1)3+1.875(0.1)4

= 0.3486875
and

y(0.2) = 3(0.2)+4.5(0.2)2+3.5(0.2)3+1.875(0.2)4

= 0.8110.

dy
3. Using Taylor’s series method solve  x 2  y, y (0)  1at 0.1 ≤ x ≤ 0.4.
dx

Soln:

Given x0  0, y 0  1 and f ( x, y )  x  y
2

Taylor’s series expansion about the point x  0 is


x 2 // x 3 /// x 4 /V
y( x)  y(0)  xy / (0)  y (0)  y (0)  y (0)   (4)
2 6 24

It is given that y(0)  0


dy
 y / ( x)  x 2  y  y / (0)  (0) 2  1  1
dx

Differentiating y ( x)  x  y successively and putting x =0, y = 1, we get


/ 2

y // ( x)  2 x  y /  y // (0)  0 y / (0)  0  (1)  1

y /// ( x)  2  y //  y /// (0)  2  y // (0)  1


y iv ( x)   y ///  y iv (0)   y /// (0)  1

/ // /// iv
Putting the values of y (0), y (0), y (0), y (0), y (0) in (4), we get

x2 x3 x4
y ( x)  1  x   
2 6 24

Hence,

(0.1) 2 (0.1) 3 (0.1) 4


y(0.1)  1  (0.1)   
2 6 24
= 0.9051625
(0.2) 2 (0.2) 3 (0.2) 4
y(0.2)  1  (0.2)   
2 6 24
= 0.8212667.
(0.3) 2 (0.3) 3 (0.3) 4
y(0.3)  1  (0.3)   
2 6 24
= 0.7491625.
(0.4) 2 (0.4) 3 (0.4) 4
y(0.4)  1  (0.4)   
2 6 24
= 0.6896.

Modified Euler’s Method

dy
Consider the IVP  f ( x, y ), y ( x0 )  y0 . The following two methods can be used to
dx
determine the solution at a point x  xn  x0  nh .

Euler’s Method :

y nE1  y n  hf ( x n , y n ), n  0,1,2,3, (1)

Modified Euler’s Method :

y n 1  y n 
h
2
 
f ( x n , y n )  f ( x n 1 , y nE1 ) , n  0,1,2,3,  (2)

Remark:

1. The formulae (1) and (2) are also known as Euler’s Predictor – Corrector formula.

2. When Modified Euler’s method is applied to find the solution at a give point, we first find
the solution at that point by using Euler’s method and the same will be used in the
calculation of Modified Euler’s method. Also Modified Euler’s method has to be applied
repeatedly until the solution is stationary.
Problems:
dy y2
1. Solve  , y(0)  1 by Euler’s method by choosing h = 0.1 and h = 0.05. Also solve
dx 1 x
the same problem by modified Euler’s method by choosing h = 0.05. Compare the numerical
solution with analytical solution.

Soln:

dy dx 1
   log(1  x)  c
y 2
1 x y

Using the condition y(0) = 1, we get c = 1.


1
Hence the analytical solution is y  y(0.2) = 0.84579
1  log(1  x)
 y2 
Now by Euler’s method, we have y n 1  y n  0.1 n 
 1  xn 
 (1) 2 
y1  y(0.1)  1  0.1   0.9
 1  0 
 (0.9) 2 
y 2  y(0.2)  0.9  0.1   0.82636
 1  0.1 
 y n2 
Now taking h = 0.05, Euler’s method is y n 1  y n  0.05 
 1  xn 

 (1) 2 
y1  y(0.05)  1.0  0.05   0.95
1 0 
 (0.95) 2 
y 2  y(0.1)  0.95  0.05   0.90702
 1  0.05 
 (0.90702) 2 
y3  y(0.15)  0.90702  0.05   0.86963
 1  0.1 
 (0.86963) 2 
y 4  y(0.2)  0.86963  0.05   0.83675
 1  0.15 

Stage – I: Finding y1 = y(0.05)

From Euler’s formula (for n = 0),


 (1) 2 
y1E  y(0.05)  1.0  0.05   0.95
1 0 
From Modified Euler’s formula, we have

 (1) 2 (0.95) 2 
y1(1)  y(0.05)  1.0  0.025    0.95351
 1  0 1  0.05 
 (1) 2 (0.95351) 2 
y1( 2)  y(0.05)  1.0  0.025    0.95335
1 0 1  0.05 
 (1) 2 (0.95335) 2 
y( 3)
 y(0.05)  1.0  0.025    0.95336
1 0 1  0.05 
1

 (1) 2 (0.95336) 2 
y1( 4)  y(0.05)  1.0  0.025    0.95336
1 0 1  0.05 
Hence y1  y(0.05)  0.95336

Stage – II: Finding y2 = y(0.1)

From Euler’s formula (for n = 1), we get

 (0.95336) 2 
y 2E  y(0.1)  0.95336  0.05   0.91008
 1  0.05 
From Modified Euler’s formula, we have

 (0.95336) 2 (0.91008) 2 
y 2(1)  y(0.1)  0.95336  0.025    0.91286
 1  0.05 1  0.1 
 (0.95336) 2 (0.91286) 2 
y 2  y(0.1)  0.95336  0.025
( 2)
   0.91278
 1  0.05 1  0 .1 
 (0.95336) 2 (0.91278) 2 
y 2( 2)  y(0.1)  0.95336  0.025    0.91278
 1  0.05 1  0.1 

Hence y 2  y(0.1)  0.91278

Stage – III: Finding y3 = y(0.15)

From Euler’s formula (for n = 2), we get

 (0.91278) 2 
y3E  y(0.15)  0.91278  0.05   0.87491
 1  0.1 
From Modified Euler’s formula (for n = 2), we have
 (0.91278) 2 (0.87491) 2 
y3(1)  y(0.15)  0.91278  0.025    0.87720
 1  0.1 1  0.15 
 (0.91278) 2 (0.87720) 2 
y3( 2)  y(0.15)  0.91278  0.025    0.87712
 1  0.1 1  0.15 

 (0.91278) 2 (0.87712) 2 
y3(3)  y(0.15)  0.91278  0.025    0.87712
 1  0.1 1  0.15 
Hence y3  y(0.15)  0.87712

Stage – IV: Finding y4 = y(0.2)

From Euler’s formula (for n = 3), we get


 (0.87712) 2 
y 4E  y(0.2)  0.87712  0.05   0.84367
 1  0.15 
From Modified Euler’s formula(for n = 3), we have

 (0.87712) 2 (0.84367) 2 
y  y(0.2)  0.87712  0.025
(1)
   0.84557
 1  0.15 1  0.2 
4

 (0.87712) 2 (0.84557) 2 
y 4( 2)  y(0.2)  0.87712  0.025    0.84550
 1  0.15 1  0.2 
 (0.87712) 2 (0.84550) 2 
y 4( 2)  y(0.2)  0.87712  0.025    0.84550
 1  0.15 1  0.2 

Hence y 4  y(0.2)  0.84550

2. Solve the following IVP by Euler’s modified method at 0.2  x  0.8 with h = 0.2:
dy
 log 10 ( x  y ), y ( 0)  2 .
dx

Soln:
Given Data is: x 0  0, y 0  2, h  0.2 and f ( x, y )  log 10 ( x  y )
To Find: y1  y( x1 )  y(0.2), y 2  y( x 2 )  y(0.4), y 3  y( x 3 )  y(0.6)
& y 4  y( x 4 )  y(0.8)
Stage – I: Finding y1 = y(0.2)

From Euler’s formula (for n = 0),


y1E  y (0.2)  2.0  0.2 log 10 0  2  2.0602

Now from Modified Euler’s formula (for n = 0), we have

y1(1)  y (0.2)  2.0  0.1log 10 (0  2)  log 10 (0.2  2.0602  2.0655

y1( 2)  y (0.2)  2.0  0.1log 10 (0  2)  log 10 (0.2  2.0655  2.0656

y1(3)  y (0.2)  2.0  0.1log 10 (0  2)  log 10 (0.2  2.0656  2.0656

Hence y1  y(0.2)  2.0656

Stage – II: Finding y2 = y(0.4)

From Euler’s formula (for n = 1),

y 2E  y (0.4)  2.0656  0.2 log 10 0.2  2.0656   2.1366

Now from Modified Euler’s formula (for n = 1), we have

y 2(1)  y (0.4)  2.0656  0.1log 10 (0.2  2.0656)  log 10 (0.4  2.1366  2.1415

y 2( 2)  y (0.4)  2.0656  0.1log 10 (0.2  2.0656)  log 10 (0.4  2.1415  2.1416

y 2(3)  y (0.4)  2.0656  0.1log 10 (0.2  2.0656)  log 10 (0.4  2.1416  2.1416

Hence y 2  y(0.4)  2.1416

Stage – III: Finding y3 = y(0.6)

From Euler’s formula (for n = 2),

y 3E  y (0.6)  2.1416  0.2 log 10 0.4  2.1416   2.2226

Now from Modified Euler’s formula (for n = 2), we have

y 3(1)  y (0.6)  2.1416  0.1log 10 (0.4  2.1416)  log 10 (0.6  2.2226  2.2272

y3( 2)  y (0.6)  2.1416  0.1log 10 (0.4  2.1416)  log 10 (0.6  2.2272  2.2272

Hence y3  y (0.6)  2.2272

Stage – IV: Finding y4 = y(0.8)


From Euler’s formula (for n = 3),

y 3E  y (0.8)  2.2272  0.2 log 10 0.6  2.2272   2.3175

Now from Modified Euler’s formula (for n = 3), we have

y 4(1)  y (0.8)  2.2272  0.1log 10 (0.6  2.2272)  log 10 (0.8  2.3175  2.3217

y 4( 2)  y (0.8)  2.2272  0.1log 10 (0.6  2.2272)  log 10 (0.8  2.3217  2.3217

Hence y 4  y(0.8)  2.3217

dy
3. Using modified Euler’s method solve the IVP  sin x  cos y, y (2.5)  0 at
dx
x=3.5 in two steps, modifying the solution thrice at each stages. Here x is in radians.

Soln:

Given x0  2.5, y 0  0, h  0.5 and f ( x, y)  sin x  cos y

To Find: y1  y( x1 )  y(3.0) and y 2  y( x2 )  y(3.5)

Stage – I: Finding y1 = y(3.0)

From Euler’s formula (for n = 0),

y1E  y (3.0)  0.0  0.5sin( 2.5)  cos(0)  0.7992

Now from Modified Euler’s formula (for n = 0), we have

y1(1)  y(3.0)  0.0  0.25sin( 2.5)  cos(0)   sin(3.0)  cos(0.7992)   0.6092


y1( 2)  y(3.0)  0.0  0.25sin( 2.5)  cos(0)   sin(3.0)  cos(0.6092)   0.6399

y1(3)  y(3.0)  0.0  0.25sin( 2.5)  cos(0)   sin(3.0)  cos(0.6399)   0.6354

Hence y1  y(3.0)  0.6354

Stage – II: Finding y2 = y(3.5)

From Euler’s formula (for n = 1),


y 2E  y(3.5)  0.6354  0.5sin(3.0)  cos(0.6354)  1.10837
Now from Modified Euler’s formula (for n = 1), we have

y 2(1)  y(3.5)  0.6354  0.25sin(3.0)  cos(0.6354)   sin(3.5)  cos(1.10837)   0.89572

y 2( 2)  y(3.5)  0.6354  0.25sin(3.0)  cos(0.6354)   sin(3.5)  cos(0.89572)   0.94043

y 2(3)  y(3.5)  0.6354  0.25sin(3.0)  cos(0.6354)   sin(3.5)  cos(0.94043)   0.93155

Hence y 2  y(3.5)  0.93155

4. Using modified Euler’s method obtain the solution of the differential equation
dy
 x y with the initial condition y = 1 at x = 0 for the range 0 < x  0.6 in steps of 0.2.
dx

Soln:
Given x0  0, y 0  1, h  0.2 and f ( x, y )  x  y
To Find: y1  y ( x1 )  y(0.2), y 2  y( x2 )  y(0.4) and y3  y ( x3 )  y(0.6)

The Entire Calculations can be put in the following Tabular Form

X Y1  f ( x n , y n ) y n  hf ( xn , y n ) Y2  f ( xn1 , y n1 )
y n 1  y n 
h
Y1  Y2 
2
0.2 1 1.2 1.2954 1.2295
1.3088 1.2309
1.3094 1.2309
0.4 1.3094 1.4927 1.6218 1.5240
1.6345 1.5253
1.6350 1.5253
0.6 1.6350 1.8523 1.9610 1.8849
1.9729 1.8861
1.9734 1.8861

The solution is: y(0.2)  1.2309, y(0.4)  1.5253 and y(0.6)  1.8861

Runge – Kutta Method

The Taylor’s series method to solve IVPs is restricted by the difficulty in finding the higher order
derivatives. However, Runge – Kutta method do not require the calculations of higher order
derivatives. Euler’s method and modified Euler’s method are Runge – Kutta methods of first and
second order respectively.
dy
Consider the IVP  f ( x, y ), y ( x0 )  y0 . Let us find the approximate value of yat x  x n 1 ,
dx
n = 0,1,2,3,…..of this numerically, using Runge – Kutta method, as follows:

First let us calculate the quantities k1 , k 2 , k 3 and k 4 using the following formulae.

k1  hf ( xn , y n )
 h k 
k 2  hf  x n  , y n  1 
 2 2
 h k 
k 3  hf  x n  , y n  2 
 2 2
k 4  hf xn  h, y n  k 3 

Finally, the required solution y is given by

y n 1  y n 
1
k1  2k 2  2k 3  k 4 
6

Problems:

1. Apply Runge – Kutta method, to find an approximate value of y when x = 0.2 given that
dy
 x  y, y ( 0)  1 .
dx

Soln:

Given: x0  0, y 0  1, h  0.2 and f ( x, y )  x  y

R – K method (for n = 0) is: y1  y (0.2)  y 0 


1
k1  2k 2  2k 3  k 4  -------- (1)
6
Now
k1  hf ( x0 , y 0 )  0.2  [0  1] = 0.2
 h k   0.2   0.2 
k 2  hf  x0  , y 0  1   0.2   0    1  
2 
= 0.2400
 2 2  2  
 h k   0.2   0.24 
k 3  hf  x0  , y 0  2   0.2   0    1   = 0.2440
 2 2  2   2 

k 4  hf x0  h, y 0  k 3   0.2  0  0.2  1  0.2440 = 0.2888


Using the values of k1 , k 2 , k 3 and k 4 in (1), we get

1
0.2  0.24  0.244  0.2888 = 1.2468
y1  y (0.2)  1 
6
Hence the required approximate value of y is 1.2468.

dy y 2  x 2
2.UsingRunge – Kutta method of fourth order, solve  , y (0)  1 at
dx y 2  x 2
x = 0.2 & 0.4.

Soln:
y2  x2
Given: x0  0, y 0  1, h  0.2 and f ( x, y ) 
y2  x2

Stage – I: Finding y1  y(0.2)

R – K method (for n = 0) is: y1  y (0.2)  y 0 


1
k1  2k 2  2k 3  k 4  -------- (2)
6

k1  hf ( x0 , y 0 )  0.2  f (0,1) = 0.2


 k 
k 2  hf  x0  , y 0  1   0.2  f 0.1,1.1
h
= 0.19672
 2 2
 k 
k 3  hf  x0  , y 0  2   0.2  f 0.1,1.0936 
h
= 0.1967
 2 2

k 4  hf x0  h, y0  k 3   0.2  f 0.2,1.1967  = 0.1891

Using the values of k1 , k 2 , k 3 and k 4 in (2), we get

y1  y (0.2)  1 
1
0.2  2(0.19672)  2(0.1967)  0.1891
6

= 1+0.19599

= 1.19599
Hence the required approximate value of y is 1.19599.
Stage – II: Finding y 2  y(0.4)

We have x1  0.1, y1  1.19599 and h  0.2

R – K method (for n = 1) is: y 2  y (0.4)  y1 


1
k1  2k 2  2k 3  k 4  -------- (3)
6
k1  hf ( x1 , y1 )  0.2  f (0.2, 1.19599) = 0.1891
 k 
k 2  hf  x1  , y1  1   0.2  f 0.3, 1.2906 
h
= 0.1795
 2 2
 k 
k 3  hf  x1  , y1  2   0.2  f 0.3, 1.2858
h
= 0.1793
 2 2

k 4  hf x1  h, y1  k 3   0.2  f 0.4, 1.3753 = 0.1688

Using the values of k1 , k 2 , k 3 and k 4 in (3), we get

y 2  y (0.4)  1.19599 
1
0.1891  2(0.1795)  2(0.1793)  0.1688
6
= 1.19599 + 0.1792

= 1.37519

Hence the required approximate value of y is 1.37519.

3. Apply Runge – Kutta method to find an approximate value of y when x = 0.2 with h = 0.1
dy y
for the IVP  3x  , y (0)  1 . Also find the Analytical solution and compare with the
dx 2
Numerical solution.

Soln:
y
Given: x 0  0, y 0  1, h  0.1 and f ( x, y )  3 x 
2
Stage – I: Finding y1  y(0.1)

R – K method (for n = 0) is: y1  y (0.1)  y 0 


1
k1  2k 2  2k 3  k 4  -------- (4)
6

k1  hf ( x0 , y 0 )  0.1  f (0,1) = 0.05


 k 
k 2  hf  x0  , y 0  1   0.1  f 0.05, 1.025
h
= 0.06625
 2 2
 k 
k 3  hf  x0  , y 0  1   0.1  f 0.05, 1.033125 
h
= 0.0666563
 2 2
 k 
k 4  hf  x0  , y 0  1   0.1  f 0.1, 1.0666563
h
= 0.0833328
 2 2

Using the values of k1 , k 2 , k 3 and k 4 , we get


y1  y (0.1)  1.0 
1
0.05  2(0.06625)  2(0.0666563)  0.0833328 
6
= 1.0 + 0.0665242

= 1.0665242

Hence the required approximate value of y is 1.0665242.

Stage – II: Finding y 2  y(0.2)

We have x1  0.1, y1  1.0665242 and h  0.1

R – K method (for n = 1) is: y 2  y (0.2)  y1 


1
k1  2k 2  2k 3  k 4  -------- (5)
6

k1  hf ( x1 , y1 )  0.1 f (0.1, 1.0665242) = 0.0833262


 k 
k 2  hf  x1  , y1  1   0.1  f 0.15, 1.04 
h
= 0.1004094
 2 2
 k 
k 3  hf  x1  , y1  2   0.1  f 0.15, 1.0485
h
= 0.1008364
 2 2

k 4  hf x1  h, y1  k 3   0.1  f 0.2, 1.097425 = 0.1183680

Using the values of k1 , k 2 , k 3 and k 4 in (5), we get

y 2  y (0.2)  1.0665242 
1
0.0833262  2(0.1004094)  2(0.1008364)  0.1006976 
6

= 1.0665242 + 0.1006976

= 1.1672218
Hence the required approximate value of y is 1.1672218.

Milne’s Method:
dy
Given  f ( x, y ), y ( x 0 )  y 0 . To find an approximate value of y at x=x0+nh by Milne’s
dx
method, we proceed as follows: Using the given value of y( x0 )  y 0 , we compute
y( x1 )  y( x0  h)  y1 , y( x2 )  y( x0  2h)  y 2 and y( x3 )  y( x0  3h)  y3 using Taylor’s
series method.

Next, we calculate f1  f ( x1 , y1 ), f 2  f ( x2 , y 2 ) and f 3  f ( x3 , y3 ) . Then, the value of


y at x = x4 = x0+4h can be found in the following two stages.
I Stage: Predictor Method

4h
2 f1  f 2  2 f 3 
y 4( P )  y 0 
3
Then we compute f 4  f ( x 4 , y 4 )
( P)

II Stage: Corrector Method

y 4( C )  y 2 
h
 f2  4 f3  f4 
3

Then, an improved value of f4 is computed and again, corrector formula is applied to find a
better value of y4. We repeat the step until y4 remains unchanged.

Adams – Bashforth Method:

dy
Given  f ( x, y ), y ( x 0 )  y 0 . Using the given value of y( x0 )  y 0 , we first compute
dx
y( x1 )  y( x0  h)  y 1 , y( x2 )  y( x0  2h)  y 2 and y( x3 )  y( x0  3h)  y 3 using
Taylor’s series method.

Next, we calculate f 1  f ( x1 , y 1 ), f 2  f ( x2 , y 2 ) and f 3  f ( x3 , y 3 ) . Now, the value of


y at x = x1 (or y1) can be determined in two stages:

I Stage: Predictor Method

y1( P )  y 0 
h
55 f 0  59 f 1  37 f 2  9 f 3 
24

Next, we compute f 1  f ( x1 , y1 ) . To find a better approximation to y1, the following corrector


(P)

formula is used.

II Stage: Corrector Method

y1(C )  y 0 
h
9 f1  19 f 0  5 f 1  f 2 
24

Then, an improved value of f1  f ( x1 , y1 ) is calculated and again, corrector formula is


(C )

applied to find a better value of y1. This step is repeated until y1 remains unchanged and then
proceeds to calculate y2 as above.
Problems:
dy
1. Use Milne’s method to find y(0.3) for the IVP  x2  y2 , y ( 0)  1
dx
Soln:
First, let us find the values of y at the points x = -0.1, x = 0.1 and x = 0.2 by using Taylor’s series
method for the given IVP.

Taylor’s expansion of y(x) about the point x = 0(= x0) is

x 2 // x 3 ///
y( x)  y(0)  xy / (0)  y (0)  y (0) -------- (1)
2 6
Given
y / ( x)  x 2  y 2  y / (0)  0  1  1
y // ( x)  2 x  2 yy /  y // (0)  2  1  1  2
y /// ( x)  2  2 yy //  2( y / ) 2  y /// (0)  2  4  2  8

Using the values of y(0), y/(0), y//(0) and y///(0) in (1), we get
4x 3
y ( x)  1  x  x 2 
3
Putting x = -0.1, x = 0.1 and x = 0.2 in the above expression, we get

y(-0.1) = 0.9087, y(0.1) = 1.1113 and y(0.2) = 1.2507

Given:
x0  0.1, y 0  0.9087 and f 0  0.8357
x1  0, y1  1 and f1  1
x2  0.1, y 2  1.1113 and f 2  1.2449
x3  0.2, y3  1.2507 and f 3  1.6043
To Find: y 4  y( x4 )  y(0.3)

I Stage: Predictor Method


y 4( P )  y (0.3)  y 0 
4h
2 f1  f 2  2 f 3 
3
 0.9087 
4(0.1)
(2  1)  1.2449  2  1.6043
3
= 1.4372
Now we compute f 4  f (0.3,1.4372)  2.1555

II Stage: Corrector Method

y 4( C )  y (0.3)  y 2 
h
 f2  4 f3  f4 
3
y 4( C )  y (0.3)  1.1113 
0 .1
1.2449  (4  1.6043)  2.1555
3
= 1.4386
Now, we compute f 4  f (0.3,1.4386)  2.1596

y 4(C ,1)  y (0.3)  1.1113 


0.1
1.2449  (4  1.6043)  2.1596
3
y(0.3) = 1.43869

Hence, the approximate solution is y(0.3) = 1.43869

dy
2. Given  x  y 2 , y (0)  0 , y(0.2) = 0.02, y(0.4) = 0.0795 and y(0.6) = 0.1762. Compute
dx
y(1) using Milne’s Method.

Soln:

Stage - I: Finding y(0.8)

Given:
x0  0, y 0  0 and f 0  f ( x0 , y 0 )  0
x1  0.2, y1  0.02 and f1  f ( x1 , y1 )  0.1996
x2  0.4, y 2  0.0795 and f 2  f ( x2 , y 2 )  0.3937
x3  0.6, y3  0.1762 and f 3  f ( x3 , y3 )  0.56895

To Find: y 4  y( x4 )  y(0.8)

I Stage: Predictor Method

y 4( P )  y (0.8)  y 0 
4h
2 f1  f 2  2 f 3 
3
4 ( 0 .2 )
 0 (2  0.1996)  0.3937 2  2  0.56895
3
= 0.30491
Now we compute f 4  f (0.8,0.30491)  0.7070

II Stage: Corrector Method

y 4( C )  y (0.8)  y 2 
h
 f2  4 f3  f4 
3
y 4( C )  y (0.8)  0.0795 
0. 2
0.3937  4  0.56895  0.7070
3
= 0.3046
Now f 4  f (0.8,0.3046)  0.7072

Again applying corrector formula with new f4, we get

y 4( C ,1)  y (0.8)  0.0795 


0 .2
0.3937  4  0.56895  0.7072
3

 y(0.8) = 0.3046
Stage - II: Finding y(1.0)

Given:
x1  0.2, y1  0.02 and f1  f ( x1 , y1 )  0.1996
x2  0.4, y 2  0.0795 and f 2  f ( x2 , y 2 )  0.3937
x3  0.6, y3  0.1762 and f 3  f ( x3 , y3 )  0.56895
x4  0.8, y 4  0.3046 and f 4  f ( x4 , y 4 )  0.7072

To Find: y5  y ( x5 )  y (1.0)

I Stage: Predictor Method

y 5( P )  y (1.0)  y1 
4h
2 f 2  f 3  2 f 4 
3
4(0.2)
 0.02  (2  0.3937)  0.56895  2  0.7072
3
= 0.45544
Now we compute f 5  f (1.0,0.45544)  0.7926

II Stage: Corrector Method

y 5( C )  y (1.0)  y 3 
h
 f3  4 f4  f5 
3
y 5( C )  y (1.0)  0.56895 
0.2
0.56895  4  0.7072  0.7926
3
= 0.4556

Now f 5  f (1.0,0.4556)  0.7024

Again applying corrector formula with new f5, we get


y 5( C ,1)  y (1.0)  0.56895 
0 .2
0.56895  4  0.7072  0.7924
3
y(1.0) = 0.4556

 x 2 1  y , y (1)  1, y (1.1)  1.233, y (1.2)  1.548, y (1.3)  1.979 .Evaluate y(1.4)


dy
3. Given
dx
by Adam’s – Bashforth method.

Soln:

Given:
x3  1, y 3  1 and f 3  2
x2  1.1, y 2  1.233 and f 2  2.70193
x1  1.2, y 1  1.548 and f 1  3.66912
x0  1.3, y 0  1.979 and f 0  5.03451

To Find: y1  y( x1 )  y(1.4)

I Stage: Predictor Method

y1( P )  y (1.4)  y 0 
h
55 f 0  59 f 1  37 f 2  9 f 3 
24
 1.979 
(0.1)
(55  5.03451)  (59  3.66912)  (37  2.70193)  (9  2)
24
= 2.57229
Now we compute f1  f (1.4,2.57229)  7.0017

II Stage: Corrector Method

y1( C )  y (1.4)  y 0 
h
9 f1  19 f 0  5 f 1  f 2 
24
 1.979 
0.1
(9  7.0017)  (19  5.03451)  (5  3.66912)  2.70193
24
y(1.4) = 2.57495

Now, let us compute f1  f (1.4,2.57495)  7.0069

y1( C ,1)  1.979 


0. 1
(9  7.0069)  (19  5.03451)  (5  3.66912)  2.70193
24
= 2.57514
Again f1  f (1.4, 2.57514)  7.0073

y1( C , 2 )  1.979 
0.1
(9  7.0073)  (19  5.03451)  (5  3.66912)  2.70193
24

y(1.4) = 2.57514
dy
4. Given  x 2  y, y (0)  1. Find y(0.4) by Adam’s method.
dx

Soln:

First, let us find the values of y at the points x = 0.1, x = 0.2 and x = 0.3 by using Taylor’s series
method for the given IVP.

Taylor’s expansion of y(x) about the point x = 0( = x0) is

x 2 // x 3 ///
y( x)  y(0)  xy / (0)  y (0)  y (0) -------- (2)
2 6
Given
y / ( x)  x 2  y  y / (0)  0  1  1
y // ( x)  2 x  y /  y // (0)  0  (1)  1
y /// ( x)  2  2 y //  y /// (0)  2  1  1

Using the values of y(0), y/(0), y//(0) and y///(0) in (2), we get

x2 x3
y ( x)  1  x  
2 3

Putting x = 0.1, x = 0.2 and x = 0.3 in the above expression, we get

y(0.1) = 0.9051, y(0.2) = 0.8212 and y(0.3) = 0.7492

Let x3  0, y 3  1 and f 3  1


x2  0.1, y 2  0.9051 and f 2  0.8951
x1  0.2, y 1  0.8212 and f 1  0.7812
x0  0.3, y 0  0.7492 and f 0  0.6592
To Find: y1  y( x1 )  y(0.4)
I Stage: Predictor Method
y1( P )  y (0.4)  y 0 
h
55 f 0  59 f 1  37 f 2  9 f 3 
24
(0.1)
 0.7492  55  (0.6592)  59  (0.7812)  37  (0.8951)  9  (1)
24
= 0.6896507
Now we compute f1  f (0.4,0.6896507)  0.5296507

II Stage: Corrector Method

y1( C )  y (0.4)  y 0 
h
9 f1  19 f 0  5 f 1  f 2 
24
 0.7492 
0.1
9  (0.5297)  19  (0.6592)  5  (0.7812)  0.895125
24
y(0.4)=0.689652

***** END OF MODULE 4 ********

You might also like