0% found this document useful (0 votes)
32 views66 pages

P 21 Numerical Method 2

Uploaded by

sweetcharm019
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views66 pages

P 21 Numerical Method 2

Uploaded by

sweetcharm019
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Unit-2

NUMERICAL METHODS-2
(NUMERICAL SOLUTION OF ORDINARY
DIFFERENTIAL EQUATIONS)

Dr. A. K. Malik
Associate Professor, Department of ASH (Mathematics)
B K Birla Institute of Engineering & Technology, Pilani (Rajasthan)
Email: [email protected]
NUMERICAL SOLUTION OF ORDINARY
DIFFERNTIAL EQUATIONS

Many real life problems of science and engineering can be

formulated in terms of differential equations.

Some times differential equations cannot be integrated

analytically, then we use numerical methods to solve

these types of problems.


dy dy
For examples: 1.  x  y 1/ 2
2.  1  xy
dx dx
NUMERICAL METHODS FOR SOLVING
ORDINARY DIFFERNTIAL EQUATIONS
OF FIRST ORDER
1. Euler’s Method
2. Euler’s Modified Method
3. Taylor’s Series Method
4. Picard’s Method
5. Runge-Kutta method of fourth order
6. Milne’s and Adam’s Predictor-corrector methods
EULER’S METHOD
dy
Consider the differential equation y   f ( x, y)
dx
with initial condition y = y0 when x = x0 i.e., y(x0) = y0

The Euler’s method is


y n 1  y n  hf ( x n , y n )

Starting from x0 when y=y0 we can construct a table of y for


given steps of h in x.
The process of this method is very slow and to get desired
accuracy with Euler’s method, h should be taken small.
SOLVED PROBLEMS
Pr.1. Given dy  y  x with the initial condition y(0)=1,
dx yx
find y for x=0.1 in 4 steps by Euler’s method.
yx 0.1
Sol. Here f ( x , y )  , x  0, y  1, h   0.025.
yx
0 0
4
We know that the Euler’s method is y n1  y n  hf ( xn , y n )

By Putting n=0, 1, 2, 3, ………..; we get


y1  y0  h f ( x0 , y0 )
y0  x0 1 0
 y0  h  1  (0.025)  1.025
y0  x0 1 0
y2  y1  hf ( x1 , y1 )
y1  x1
 y1  h ( x1  x0  h  0  0.025  0.025)
y1  x1
1.025  0.025 1
 1.025  (0.025)   1.025  0.025 
1.025  0.025 1.05
 1.0488
y3  y2  hf ( x2 , y2 )
y 2  x2
 y2  h ( x2  x0  2h  0  2  0.025  0.05)
y 2  x2
1.0488  0.05 1.0438
 1.0488  (0.025)   1.0488  (0.025) 
1.0488  0.05 1.0988
 1.07152
y4  y3  hf ( x3 , y3 )
y3  x3
 y3  h ( x3  x0  3h  0  3  0.025  0.075)
y3  x3
1.07152  0.075
 1.07152  0.025 
1.07152  0.075

 1.09324

Hence the value of y at x=0.1 is

y (0.1)  1.09324

( x4  x0  4h  0  4  0.025  0.1)
SOLVED PROBLEMS
dy 2 2
Pr.2. Use Euler’s method to compute y(0.5) for  y x
dx
with y=1 when x=0.

0.5
Sol. Here f ( x, y )  y 2  x 2 , x0  0, y0  1, h   0.1.
5
We know that the Euler’s method is y n1  y n  hf ( xn , y n )
By Putting n=0, 1, 2, 3, ………..; we get
y1  y0  h f ( x0 , y0 )

 y0  h( y0  x0 )  1  (0.1)(12  0 2 )  1.1
2 2
y2  y1  hf ( x1 , y1 )
 y1  h( y1  x1 ) ( x1  x0  h  0  0.1  0.1)
2 2

 1.1  (0.1)  [(1.1) 2  (0.1) 2 ]  1.1  (0.1)(1.21  0.01)


 1.220

y3  y2  hf ( x2 , y2 )
 y 2  h ( y 2  x2 ) ( x2  x0  2h  0  2  0.1  0.2)
2 2

 1.22  (0.1)  [(1.22) 2  (0.2) 2 ]  1.22  (0.1)(1.4484)

 1.36484
y4  y3  hf ( x3 , y3 )
 y3  h( y3  x3 ) ( x3  x0  3h  0  3  0.1  0.3)
2 2

 1.36484  (0.1)  [(1.36484) 2  (0.3) 2 ]  1.36484  (0.1)(1.7728)

 1.54212
y5  y4  hf ( x4 , y4 )
 y 4  h ( y 4  x4 ) ( x4  x0  4h  0  4  0.1  0.4)
2 2

 1.54212  (0.1)  [(1.54212) 2  (0.4) 2 ]  1.54212  (0.1)(2.218134)

 1.7639
Hence the value of y at x=0.5 is
y (0.5)  1.763933
UNSOLVED PROBLEMS
dy
Assign.1. Use Euler’s method to compute y(0.04),  y
dx
for with y(0)=1.
Sol.
y1  0.99
y2  0.9801

y3  0.970299

y4  0.960596
EULER’S MODIFIED METHOD

The Euler’s modified formula is


( n 1) h
 y0  [ f ( x0 , y0 )  f ( x1 , y1 )]
(n)
y1
2
(n  0, 1, 2....)
This is the nth approximation of y1. For the initial value
y1(0) we use Euler’s method.

 y0  hf ( x0 , y0 )
(0)
y1
SOLVED PROBLEMS
Pr.1. Use Euler’s modified method to find y(0.1) correct to
dy 2
six decimal figures where  x  y with y(0)=0.94.
dx
Sol. Here f ( x, y )  x 2  y, x0  0, y0  0.94, h  0.1.

Using Euler’s method, we have


y1  y0  hf ( x0 , y0 )
 y0  h( x0  y0 )  0.94  (0.1)(0  0.94)  1.034
2

The value of y1 or y1(0) , thus obtained is improved by Euler’s


modified method.
( n 1) h
y1  y0  [ f ( x0 , y0 )  f ( x1 , y1( n ) )] …… (1)
2
Put n=0 in equation (1), we get

h
y (1)
1  y0  [ f ( x0 , y0 )  f ( x1 , y1( 0) )]
2
h
 y0  [( x0  y0 )  ( x1  y1( 0) )]
2 2

2
0.1
 0.94  [(0  0.94)  ((0.1) 2  1.034)]
2
 1.0392
Put n=1 in equation (1), we get

h
y( 2)
1  y0  [ f ( x0 , y0 )  f ( x1 , y1(1) )]
2
h
 y0  [( x0  y0 )  ( x1  y1(1) )]
2 2

0.1
 0.94  [(0  0.94)  ((0.1) 2  (1.0392))]
2
 1.03946
Put n=2 in equation (1), we get

h
y1( 3)  y0  [ f ( x0 , y0 )  f ( x1 , y1( 2 ) )]
2
h
 y0  [( x0  y0 )  ( x1  y1( 2) )]
2 2

2
0.1
 0.94  [(0  0.94)  ((0.1) 2  (1.03946))]
2
 1.039473
Put n=3 in equation (1), we get
h
y  y0  [ f ( x0 , y0 )  f ( x1 , y1(3) )]
( 4)
1
2
h
 y0  [( x0  y0 )  ( x1  y1(3) )]
2 2

2
0.1
 0.94  [(0  0.94)  ((0.1) 2  (1.039473))]
2
 1.039473

Here y1(3)  y1( 4)


Hence y1  1.039473  y (.1)  1.039473
SOLVED PROBLEMS
Pr.2. Using Euler’s modified method, solve numerically the
equation dy  x  y with y (0)  1 for 0  x  0.6, in steps of 0.2.
dx
Sol. Here f ( x, y )  x  y , x0  0, y0  1, h  0.2.

Using Euler’s method, we have


y1  y0  hf ( x0 , y0 )
 y0  h( x0  y0 )  1  (0.2)[0  1 ]  1.2

The value of y1 or y1(0) , thus obtained is improved by Euler’s


modified method.
( n 1) h …… (1)
y1  y0  [ f ( x0 , y0 )  f ( x1 , y1( n ) )]
2
h
Put n=0, y1(1)  y0  [ f ( x0 , y0 )  f ( x1 , y1( 0 ) )]
2
0.2
 1 [(0  1 )  (0.2  1.2 )]  1.2295
2
h
Put n=1, y
( 2)
1  y0  [ f ( x0 , y0 )  f ( x1 , y1(1) )]
2
0.2
 1 [(0  1 )  (0.2  1.2295 )]  1.2309
2
h
y
Put n=2, 1
( 3)
 y 0  [ f ( x0 , y 0 )  f ( x1 , y ( 2)
1 )]
2
0.2
 1 [(0  1 )  (0.2  1.2309 )]  1.2309
2
Hence we take y1  1.2309 at x=0.2.
Now to find y at x=0.4. First using Euler’s Method we find
the value of y2, so we have
y2  y1  hf ( x1 , y1 )  y1  h( x1  y1 )
 1.2309  (0.2)[0.2  1.2309 ]  1.49279
For y(0.4), the Euler’s modified method is
( n 1) h …… (2)
y 2  y1  [ f ( x1 , y1 )  f ( x2 , y2( n ) )]
2
Put n=0 in equation (2), we get
h
y (1)
2  y1  [ f ( x1 , y1 )  f ( x2 , y2( 0 ) )]
2
0.2
 1.2309  [(0.2  1.2309 )  (0.4  1.49279 )]
2
 1.52402
Put n=1 in equation (2), we get
h
y ( 2)
2  y1  [ f ( x1 , y1 )  f ( x2 , y2(1) )]
2
0.2
 1.2309  [(0.2  1.2309 )  (0.4  1.52402 )]
2
 1.525297

Put n=2 in equation (2), we get


h
y ( 3)
2  y1  [ f ( x1 , y1 )  f ( x2 , y2( 2 ) )]
2
0.2
 1.2309  [(0.2  1.2309 )  (0.4  1.525297 )]
2
 1.52535
Put n=3 in equation (2), we get
h
y ( 4)
2  y1  [ f ( x1 , y1 )  f ( x2 , y2( 3) )]
2
0.2
 1.2309  [(0.2  1.2309 )  (0.4  1.52535 )]
2
 1.52535

Hence y2(3)  y2( 4 )  1.52535 at x  0.4.

Now to find y at x=0.6. First using Euler’s Method we find


the value of y3, so we have
y3  y2  hf ( x2 , y2 )  y2  h( x2  y2 )
 1.52535  (0.2)[0.4  1.52535 ]  1.85236
For y(0.6), the Euler’s modified method is
( n 1) h
y3  y2  [ f ( x2 , y2 )  f ( x3 , y3( n ) )] …… (3)
2
Put n=0 in equation (3), we get
h
(1)
y
3  y2  [ f ( x2 , y2 )  f ( x3 , y3( 0 ) )]
2
0.2
 1.52535  [(0.4  1.52535 )  (0.6  1.85236 )]
2
 1.88496
Put n=1 in equation (3), we get
h
( 2)
y
3  y2  [ f ( x2 , y2 )  f ( x3 , y3(1) )]
2
0.2
 1.52535  [(0.4  1.52535 )  (0.6  1.88496 )]
2
 1.88615
Put n=2 in equation (3), we get
h
y( 3)
3  y2  [ f ( x2 , y2 )  f ( x3 , y3( 2 ) )]
2
0.2
 1.52535  [(0.4  1.52535 )  (0.6  1.88615 )]
2
 1.88619
Put n=3 in equation (3), we get
h
y3( 4 )  y2  [ f ( x2 , y2 )  f ( x3 , y3( 3) )]
2
0.2
 1.52535  [(0.4  1.52535 )  (0.6  1.88619 )]
2
 1.88619

Hence y3  y3  1.88619 at x  0.6.


( 3) ( 4)
UNSOLVED PROBLEMS
Assign.2.Use Euler’s modified method to find y(0.05) and
dy
y(0.1) correct to 6 decimal places, where  x  y with y (0)  1.
dx
Sol. y1  1.05

y1(1)  1.0525, y1( 2)  1.0525626,


y1(3)  1.052564, y1( 4)  1.0525641.
y2  1.1076922

y2(1)  1.1120511, y2( 2)  1.1104294,


y2(3)  1.1103888, y2( 4)  1.1103878, y2(5)  1.1103878.
TAYLOR’S SERIES METHOD
Consider the differential equation
dy

y   f ( x, y ) with y(x0) = y0.
dx
The Taylor’s series method is
x  x0 2 x  x0 3
y ( x)  y 0   x  x0  y 0  y0  y 0  ........
2! 3!
Putting the values of x, x0, y0, y0’, y0’’, ………. in above
equation and we get value of y(x). Taylor’s series method is
derived in any order and values of y(x) are easily obtained. But
this method take long time in computing higher derivatives.
SOLVED PROBLEMS
dy
Pr.1. Solve the differential equation  x  y with y(0)=1,
dx
by Taylor’s series method to compute y for x=0.1.
Sol. Here y  x  y, x0  0, y0  1.
Here we find some derivatives and their values at x0=0, y0 =1 are
y  x  y y0  1

y  1  y y0  2

y  0  y y0  2

y  y y0 2


The Taylor’s series method is

y ( x)  y0   x  x0  y   x  x0 
2
y 
 x  x0 
3
y 
 x  x0 
4
y ........
0 0 0 0
2! 3! 4!

Putting the value of x0, y0, y0 , y0 , y0, y0, ........
we get

y ( x)  1   x  0.(1) 
 x  0
2
2   x  0
3
2   x  0
4
2  ........
2! 3! 4!

2 x 2 2 x3 2 x 4
 1 x     ........
2! 3! 4!
Now put x=0.1 and taking up to fourth terms, we get

2
y (0.1)  1  0.1  0.1 
2
0.13  2 0.14
6 24

1 1
 1  0.1  0.1  0.1  0.1
2 3 4

3 12

1 1
 1  0.1  0.01  0.001  0.0001
3 12

 1  0.1  0.01  0.00033  0.0000083

 1.1103383
SOLVED PROBLEMS
Pr.2. Using Taylor’s series method to compute y(2.1)
dy
correct to 5 decimal places, where x  x  y with y(2)=2.
dx
y
Sol. Here y   1  , x0  2, y0  2.
x
Here we find some derivatives and their values at x=2, y=2, are
y
y  1  y0  0
x
y y 1
y    2 y0 
x x 2
y 2 y 2 y 3
y    2  3 y0  
x x x 4
y 3 y 6 y 6 y 3
y    2  3  4 y0
x x x x 2
The Taylor’s series method is

y ( x)  y0   x  x0  y   x  x0 
2
y 
 x  x0 
3
y 
 x  x0 
4
y ........
0 0 0 0
2! 3! 4!

Putting the value of x0, y0, y0 , y0 , y0, y0, ........
we get

y ( x)  2   x  2.0 
 x  2  1  x  2  3  x  2  3 
2

3
 
4
 ........
     
2! 2 3!  4  4! 2

1 1 1
 2   x  2   x  2   x  2  ........
2 3 4

4 8 16
Now put x=2.1 and taking up to fourth terms, we get

1
y (2.1)  2  2.1  22  1 2.1  23  1 2.1  24
4 8 16

1 1 1
 2  0.1  0.1  0.1
2 3 4

4 8 16

1 1 1
 2  0.01  0.001  0.0001
4 8 16

 2  0.0025  0.000125  0.00000625

 2.00238125
UNSOLVED PROBLEMS
Assign.3. Find the solution of the differential equation
dy
 x  y 2 with y (0)  1
dx

Using Taylor’s series method, at x=0.1 correct 4 decimal


places.

Sol. y (0.1)  0.9138


PICARD’S METHOD
Consider the differential equation
dy
y   f ( x, y) with y(x0) = y0.
dx
The Picard’s method is
 y0  x f ( x, y ( n 1) )dx
(n) x
y
0

Putting n=1, 2, 3, …………, whenever two value of y


becomes same to the desired degree of accuracy, where
y(0)=y0. This method is also known as the method of
successive approximations.
SOLVED PROBLEMS
Pr.1. Using Picard’s successive approximations method to
compute the values of y when x=0.1 and 0.2 given that y=1
dy
when x=0, where  x  y.
dx
Sol. Here f ( x, y )  x  y, x0  0, y0  1.

Using Picard’s successive approximations method, we have

y ( n )  y0  x f ( x, y ( n 1) )dx
x
0

Putting n=1, 2, 3, ………… ; where y(0)=y0.


The first approximations is
x
y (1)
 y0  x f ( x, y ( 0) )dx
0

x
 y0  x ( x  y ( 0) )dx
0

x
 1  0 ( x  1)dx
x
x  2
 1    x
2 0
x2
 1 x 
2
The second approximations is
x x
y ( 2)
 y0  x f ( x, y )dx  y0  x ( x  y (1) )dx
(1)
0 0

  x2 
 1  0  x    x  1 dx
x

  2 
x x2 
 1  0  2 x   1 dx
 2 
x
 2 x 3
 x3
 1   x   x  1  x   x 2

 6 0 6
x3
 1 x  x  2
6
The third approximations is
x x
y ( 3)
 y0  x f ( x, y )dx  y0  x ( x  y ( 2) )dx
( 2)
0 0

  x 3 
 1  0  x  1  x  x   dx
x 2

  6 
x x3 
 1  0  2 x   x 2  1 dx
 6 
x
 2 x 4
x  3
 1   x    x 
 24 3 0
3 4
x x
 1  x  x2  
3 24
The fourth approximations is
x x
y ( 4)
 y0  x f ( x, y )dx  y0  x ( x  y (3) )dx
( 3)
0 0

  x 3
x 4

 1  0  x  1  x  x   dx
x 2

  3 24 
x 
3 4
x x
 1  0  2 x  1  x 2    dx
 3 24 
x
 2 x x 3
x  4 5
 1   x  x    
 3 12 120  0
x3 x 4 x5
 1 x  x   2

3 12 120
The fifth approximations is
x x
y ( 5)
 y0  x f ( x, y )dx  y0  x ( x  y ( 4) )dx
( 4)
0 0

  x3 x 4 x 5 
 1  0  x  1  x  x   dx
x 2
 
  3 12 120 
x x3 x 4 x5 
 1  0  2 x  1  x 
2
   dx
 3 12 120 
x
 2 x3
x 4
x 5
x 
6
 1   x  x     
 3 12 60 720  0
3 4 5 6
x x x x
 1  x  x2    
3 12 60 720
Here we construct a table for y at x=0.1, x=0.2 and y0=1.

x=0.1 and y0=1 x=0.2 and y0=1


y(1)=0.905 y(1)=0.82

y(2)=0.9098 y(2)=0.83867

y(3)=0.90967 y(3)=0.83740

y(4)=0.90967 y(4)=0.83746

y(5)=0.83746

Hence y=0.90967 at x=0.1 and y=0.83746 at x=0.2.


SOLVED PROBLEMS
Pr.2. Using Picard’s successive approximations method to
dy
solve  x  y 2 given that x0 =0, y0 =0 up-to third order
dx
of approximations.

Sol. Here f ( x, y )  x  y 2 , x0  0, y0  0.

Using Picard’s successive approximations method, we have

 y0  x f ( x, y ( n 1) )dx
(n) x
y
0

Putting n=1, 2, 3, we get


The first approximations is

x
y (1)
 y0  x f ( x, y ( 0) )dx
0

x
 y0  x ( x  y0 )dx
2
0

x
 0  0 ( x  0)dx
x
x  2
 
 2 0
x2

2
The second approximations is
x
f ( x, y )dx  y0  x [ x  ( y ) ]dx
x
 y0  x
( 2) (1) (1) 2
y
0 0

 2 2
x 
 0  0  x     dx
x

  2  

x x4 
 0  x   dx
 4 
x
x x 
2 5
  
 2 20  0
x 2 x5
 
2 20
The third approximations is
x
f ( x, y )dx  y0  x0 [ x  ( y ) ]dx
x
 y0  x
( 3) ( 2) ( 2) 2
y
0

  x 2 5 2
x 
 0  0  x      dx
x

  2 20  

x x 4 x10 x 7 
 0  x     dx
 4 400 20 
x
x 2
x x x 
5 8 11
     
 2 20 160 4400  0
x 2 x 5 x8 x11
   
2 20 160 4400
UNSOLVED PROBLEMS
Assign.4. Using Picard’s method to compute up-to second
approximations to y(0.25), y(0.5) and y(1) correct to 3
dy x2
decimals, where  2 with y (0)  0.
dx y  1
Sol.
x3
y (1)  .
3
3
1   x 1 x 
3 3 3
x
y ( 2)

 tan        ....
3  3 3 3 
RUNGE-KUTTA METHOD OF
FOURTH ORDER
dy
Consider the differential equation  f ( x, y ) with y(x0)=y0.
dx
Runge-Kutta method of fourth order is yn+1 = yn+k for x1=x0+h
h
k  [k1  2(k 2  k3 )  k 4 ]
6
where k1  f ( x0 , y0 )
 h h  h h
k 2  f  x0  , y0  k1 , k3  f  x0  , y0  k 2 
 2 2  2 2
k 4  f  x0  h, y0  k3h 
SOLVED PROBLEMS
Pr.1. Using Runge-Kutta method, obtain a solution of the
dy
equation  xy, y (1)  2 for x=1.4 using h=0.2.
dx
Sol. Here f ( x, y )  xy, x0  1, y0  2, h  0.2.

 f ( x0 , y0 )  x0 y0  1  2  2.
h
Runge-Kutta method of 4th order is k  [k1  2(k 2  k3 )  k 4 ]
6
for y1=y0+k for x1=x0+h=1+0.2 =1.2
where
k1  f ( x0 , y0 )  x0 y0  1 2  2.
 h h  h  h
k 2  f  x0  , y0  k1    x0     y0  k1 
 2 2  2  2
 0.2  0.2 
 1   2  2    (1.1)(2.2)  2.42
 2  2 

 h h  h  h
k3  f  x0  , y0  k 2    x0   y0  k 2 
 2 2  2  2

 0.2  0.2 
 1   2  2.42    (1.1)(2.242)  2.4662
 2  2 
k 4  f ( x0  h, y0  k3h)  ( x0  h)( y0  k3h)

 (1  0.2)(2  2.4662  0.2)  (1.2)(2.49324)  2.9918


h
Now we have k  [k1  2(k 2  k3 )  k 4 ]
6
0.2
 [2  2(2.42  2.4662)  2.9918]
6
 0.49214
This show that
x1  x0  h  1  0.2  1.2
and
y1  y0  k  2  0.49214  2.4921

Therefore
y(1.2)  2.4921
Now for the second interval
x1  1.2, y1  2.4921, h  0.2.
f ( x1 , y1 )  x1 y1  1.2  2.4921  2.99052.
Now to find the value of y2=y1+k for x2=x1+h=1.2+0.2 =1.4;
first we find k, so we have
k1  f ( x1 , y1 )  x1 y1  1.2  2.4921  2.99052.

 h h  h  h
k 2  f  x1  , y1  k1    x1     y1  k1 
 2 2  2  2
 0.2  0.2 
 1.2   2.4921  2.9905    (1.3)(2.79105)
 2  2 
 3.6283.
 h h  h  h
k3  f  x1  , y1  k 2    x1   y1  k 2 
 2 2  2  2

 0.2  0.2 
 1.2   2.4921  3.6283    (1.3)(2.8548)
 2  2 

 3.71143.

k 4  f ( x1  h, y1  k3h)  ( x1  h)( y1  k3h)

 (1.2  0.2)(2.4921  3.71128  0.2)  (1.4)(3.2343)

 4.5281.
h
Now we have k  [k1  2(k 2  k3 )  k 4 ]
6
0.2
 [2.9905  2(3.6283  3.7112)  4.5281]
6
 0.73992.
This show that
x2  x1  h  1.2  0.2  1.4
and
y2  y1  k  2.4921  0.73992  3.2330.

Therefore
y (1.4)  3.2321.
SOLVED PROBLEMS
Pr.2. Using Runge-Kutta method of fourth order to find
dy
y(1.2), given that  x 2  y 2 , y (1)  0.
dx
Sol. Here f ( x , y )  x 2
 y 2
, x0  1, y0  0, h  0.2.

 f ( x0 , y0 )  x0  y0  12  0  1.
2 2

h
Runge-Kutta method of 4th order is k  [k1  2(k 2  k3 )  k 4 ]
6
for y1=y0+k for x1=x0+h=1+0.2 =1.2
where
k1  f ( x0 , y0 )  x0  y0  12  0  1.
2 2
2 2
 h h  h  h
k 2  f  x0  , y0  k1    x0     y0  k1 
 2 2  2  2
2 2
 0.2   0.2 
 1     0  1   (1.1)  (0.1)  1.22.
2 2

 2   2 
2 2
 h h  h  h
k3  f  x0  , y0  k 2    x0     y0  k 2 
 2 2  2  2
2
 0.2   0.2 
 1     0  1.22    (1.1)  (0.122)  1.224884.
2

 2   2 

k 4  f ( x0  h, y0  k3h)  ( x0  h) 2  ( y0  k3h) 2

 (1  0.2) 2  (0  1.224884  0.2) 2  (1.2) 2  (0.2449768)  1.500014.


h
Now we have k  [k1  2(k 2  k3 )  k 4 ]
6
0.2
 [1  2(1.22  1.224884)  1.500014]
6
 0.246326.
This show that
x1  x0  h  1  0.2  1.2
and
y1  y0  k  0  0.246326  0.246326

Therefore
y (1.2)  0.246326.
UNSOLVED PROBLEMS
Assign.5. Use Runge-Kutta method of fourth order to find
the approximate value of y for x=0.4 if

dy
 x  y2
dx
given that y=1 when x=0, taking h=0.2.
MILNE’S AND ADAM’S PREDICTOR -
CORRECTOR METHODS
dy
Consider the differential equation  f ( x, y ) with y(x0)=y0.
dx
4h
The predictor formula is y n1  y n3  (2 y n 2  y n 1  2 y n )
3
h
The corrector formula is y
(1)
n 1  yn 1  ( yn 1  4 yn  yn 1 )
3
In Milne’s and Adam’s predictor- corrector method, first we
obtain the value of yn+1 by predictor formula and then improve
this value by corrector formula until we get two values of yn+1
become same to the desired degree of accuracy.
SOLVED PROBLEMS
Pr.1. Use Milne’ s predictor - corrector method to find y(0.8),
dy
given that  x  y 2 ; y(0)  0, y(0.2)  0.02, y(0.4)  0.0795,
dx
y(0.6)  0.1762.
Sol. Here y  x  y 2 , then we have

x0=0 y0=0 y0'= x0 - y02 = 0


x1=0.2 y1 = 0.02 y1' = x1 - y12 = 0.1996
x2=0.4 y2 = 0.0795 y2' = x2 - y22 = 0.3937
x3=0.6 y3 = 0.1762 y3' = x3 - y32 = 0.5690
Taking n=3, the predictor formula, we have
4h
y 4  y0  (2 y1  y2  2 y3 )
3
4(0.2)
0 [2(0.1996)  0.3937  2(0.5690)]  0.3049
3
Now we have y4’= x4 -y42 = 0.8- (0.3049)2 =0.7070.

The corrector formula is


h
y4(1)  y2  ( y2  4 y3  y4 )
3
0.2
 0.0795  [0.3937  4(0.5690)  0.7070]
3
 0.3046
Hence y4=0.3046 at x4=0.8, by corrected
y4’=0.8-(0.3046)2=0.7072. Again using corrector formula,
we have
h
y4( 2)  y2  ( y2  4 y3  y4 )
3
0.2
 0.0795  [0.3937  4(0.5690)  0.7072]
3

 0.3046

Hence y(0.8)=0.3046.
SOLVED PROBLEMS
Pr.2. Use Milne’ s predictor - corrector method to find y(0.4),
dy
given that  1  xy 2 ; y(0)  1, y(0.1)  1.105, y(0.2)  1.223,
dx
y(0.3)  1.355.
Sol. Here y  1  xy 2 , then we have

x0=0 y0=1 y0'=1+x0y02 =1


x1=0.1 y1=1.105 y1'=1+x1 y12 =1.1221
x2=0.2 y2=1.223 y2'=1+x2 y22 =1.2991
x3=0.3 y3=1.355 y3'=1+x3 y32 =1.5508
Taking n=3, the predictor formula, we have
4h
y 4  y0  (2 y1  y2  2 y3 )
3
4(0.1)
 1 [2(1.1221)  1.2991  2(1.5508)]  1.5396
3
Now we have y4’= 1+x4 y42 =1+(0.4)(1.5396)2 =1.9481.

The corrector formula is


h
y4(1)  y2  ( y2  4 y3  y4 )
3
0.1
 1.223  [1.2991  4(1.5508)  1.9481]
3
 1.5380.
Hence y4=1.5380 at x4=0.4, by corrected
y4’=1+(0.4)(1.5380)2 =1.9462.
Again using corrector formula, we have
h
y4( 2)  y2  ( y2  4 y3  y4 )
3
0.1
 1.223  [1.2991  4(1.5508)  1.9462]
3

 1.5380

Hence y(0.4)=1.5380.
SOLVED PROBLEMS
dy 1
Assign.6. Given that  (1  x 2 ) y 2 and y(0)  1,
dx 2
y(0.1)  1.06, y(0.2)  1.12, y(0.3)  1.21. Evaluate
y(0.4) by Milne’ s predictor method.
Thank You

You might also like