0% found this document useful (0 votes)
13 views37 pages

Module 5 Numerical Methods 2

This document discusses numerical methods for solving ordinary differential equations (ODEs) that cannot be solved analytically, focusing on first-order equations. It outlines various methods such as Taylor's series, Modified Euler's method, and Runge-Kutta method, providing detailed explanations and examples for each. Additionally, it includes practice problems for further application of the methods discussed.
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)
13 views37 pages

Module 5 Numerical Methods 2

This document discusses numerical methods for solving ordinary differential equations (ODEs) that cannot be solved analytically, focusing on first-order equations. It outlines various methods such as Taylor's series, Modified Euler's method, and Runge-Kutta method, providing detailed explanations and examples for each. Additionally, it includes practice problems for further application of the methods discussed.
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/ 37

Bangalore Institute of Technology

MODULE-5

Numerical Solutions of Ordinary Differential Equations(ODE’s)

Some differential equations cannot be solved using analytical method. an


approximate solution may be obtained using numerical methods

In this module we solve first order and first degree ordinary differential equations
of the form

dy
 f ( x, y ) with y ( x0 )  y0
dx

Various methods to solve ordinary differential equations


1) TAYLOR’S SERIESMETHOD

2) MODIFIED EULER’SMETHOD

3) RUNGE – KUTTA METHOD OF FOURTH ORDER

4) MILNE’S PREDICTOR AND CORRECTOR METHOD

5) ADAM-BASHFORTH PREDICTOR AND CORRECTOR METHOD

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

TAYLOR’S SERIES METHOD


Consider the initial value problem

dy
 f ( x, y ) with y ( x0 )  y0
dx
Let y  y( x) be the solution of this problem.

Expanding y( x) in Taylor’s series about the point x0 , we get


4
(x - x0 ) (x - x0 )2 (x - x0 )3 (x - x0 )
y(x) = y(x0 )+ y (x0 )+ y2 (x0 )+ y3 (x0 )+ y4 (x0 )+ ...
1! 1
2! 3! 4!

Working Rule:

dy
Given x0 , y0 and y1 ( x)   f ( x, y )
dx


Find y1 ( x0 ) by replacing x by x0 and y by y0

Differentiate y1 ( x) w.r.t. x , we get y2 ( x) .
Then replace x by x0 , y by y0 and y1 by y1 ( x0 ) we get y2 ( x0 )

Differentiate y2 ( x) w.r.t. x , we get y3 ( x) and etc.
Then replace x by x0 , y by y0 , y1 by y1 ( x0 ) and y2 by y2 ( x0 )
We get y3 ( x0 )

and etc.

Finally substitute all the values in y ( x)

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

Problems:

1) Use Taylor’s series method to find y at x = 0.1 & x = 0.2, considering


dy
terms up to the fourth degree, given that = x 2 + y 2 with y(0) = 1
dx
Solution: We have Taylor’s series expansion

( x  x0 ) ( x  x0 ) 2 ( x  x0 )3 ( x  x0 )
4

y ( x)  y ( x0 )  y ( x0 )  y2 ( x0 )  y3 ( x0 )  y4 ( x0 )  ...
1! 1
2! 3! 4!
But given x0  0 , then
4

y4 (0)  ...  1


( x) ( x) 2 ( x)3 ( x)
y ( x)  y (0)  y (0)  y2 (0)  y3 (0) 
1! 1
2! 3! 4!

y(0)  1

y1 ( x )  x 2  y 2  y1 (0)  02  12  1

y2 ( x)  2 x  2 yy1  y2 (0)  2(0)  2(1)(1)  2

y3 ( x)  2  2( yy2  y12 )  y3 (0)  2  2(1)(2)  (1)2   8

y4 ( x)  2  ( yy3  y1 y2 )  2 y1 y2   y4 (0)  2  ((1)(8)  (1)(2))  2(1)(2)   28


4
( x) ( x) 2 ( x) 3 ( x)
(1)  y ( x)  1  (1)  (2)  (8)  (28)
1! 2! 3! 4!

x  x 
3 4

y  x  = 1+ x + x 2
+4 +7
3 6
Put x  0.1& x  0.2 we get

 0.1  0.1
3 4

y  0.1 = 1+  0.1 +  0.1


2
+4 +7
3 6
= 1.1115

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

 0.2   0.2 
3 4

y  0.2  = 1+  0.2  +  0.2 


2
+4 +7 = 1.2525
3 6

dy
2) Solve = e x - y with y  0  = 2 using Taylor’s series method up to 4th
dx
degree terms and find the value of y  1.1 

Solution: We have Taylor’s series expansion

( x  x0 ) ( x  x0 ) 2 ( x  x0 )3 ( x  x0 )
4

y ( x)  y ( x0 )  y ( x0 )  y2 ( x0 )  y3 ( x0 )  y4 ( x0 )  ...
1! 1
2! 3! 4!
But given x0  0 , then
4

y4 (0)  ...  1


( x) ( x) 2 ( x)3 ( x)
y ( x)  y (0)  y (0)  y2 (0)  y3 (0) 
1! 1
2! 3! 4!

y(0)  2

y1 ( x)  e x  y  y1 (0)  e0  2  1  2  1

y2 ( x)  e x  y1  y2 (0)  e0   1  2

y3 ( x)  e x  y2  y3 (0)  e0  2  1

y4 ( x)  e x  y3  y4 (0)  e0   1  2
4
( x) ( x) 2 ( x) 3 ( x)
(1)  y ( x)  2  (1)  (2)  (1)  (2)
1! 2! 3! 4!

x  x 
3 4

y x  = 2 - x + x 2
 +
6 12

Put x  1.1

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

1.1 1.1
3 4

y 1.1 = 2 - 1.1 + 1.1


2
 +
6 12
= 2.0102

dy
3) Using Taylor’s series method, solve the initial value problem = x2 y - 1
dx
with y(0) = 1 at the point x = 0.1

Solution: We have Taylor’s series expansion

( x  x0 ) ( x  x0 ) 2 ( x  x0 )3 ( x  x0 )
4

y ( x)  y ( x0 )  y ( x0 )  y2 ( x0 )  y3 ( x0 )  y4 ( x0 )  ...
1! 1
2! 3! 4!
But given x0  0 , then
4

y4 (0)  ...  1


( x) ( x) 2 ( x)3 ( x)
y ( x)  y (0)  y (0)  y2 (0)  y3 (0) 
1! 1
2! 3! 4!

y(0)  1

y1 ( x)  x 2 y -1  y1 (0)  0(1)  1  1

y2 ( x)  x 2 y1  2 xy  y2 (0)  0(1)  2(0)(1)  0

y3 ( x)   x 2 y2  2 xy1   2  xy1  y 
 y3 (0)  0  0  2 1  2
 x 2 y2  4 xy1  2 y

y4 ( x)   x 2 y3  2 xy2   4( xy2  y1 )  2 y1
 y4 (0)  0  0  6  1  6
 x y3  6 xy2  6 y1
2

4
( x) ( x) 2 ( x)3 ( x)
(1)  y ( x)  1  (1)  (0)  (2)  (6)
1! 2! 3! 4!

x  x 
3 4

y x  = 1- x + 
3 4

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

Put x  0.1

 0.1  0.1
3 4

y  0.1 = 1-  0.1 + 
3 4
= 0.9003

Practices problems

1) Using Taylor’s series method, find y at x = 0.4 of the initial value problem
dy
= x 2 y + 1 with y  0  = 0 considering up to 4th degree terms
dx
2) Using Taylor’s series method, find y  0.1  considering up to 4th degree
dy
terms, given that = x - y 2 with y  0  = 1
dx
dy
3) Using Taylor’s series method, solve = x 2 + y in the range 0 ≤ x ≤ 0.2 by
dx
taking step size h = 0.1 , given that y = 10 at x = 0 initially, considering up to
4th degree terms.

4) Find y at x = 1.02 correct to four decimal places, given that


dy =  xy - 1 dx and y = 2 at x = 1 by applying Taylor’s series method

dy 1
5) Use Taylor’s series method to find y  4.1  given that = 2 with
dx x + y
y 4 = 4

6) Employ Taylor’s series method to find y at x = 0.1 & x = 0.2 given that
dy
- 2y = 3e x with y  0  = 0 considering up to 4th degree terms
dx

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

MODIFIED EULER’SMETHOD
Consider the initial value problem

dy
 f ( x, y ) with y ( x0 )  y0
dx
We determine the solution y at x1  x0  h by using Euler’s formula

y10  = y0 + hf  x0 , y0 

This gives approximate value of y at x1

To improve this value y1 successively to the desired degree of accuracy by the


following Modified Euler’s formula

1st approximation (1st modification)

y11 = y0 +
h
2

f  x0 , y0  + f  x1 , y10  
2nd approximation (2nd modification)

y1 2  = y0 +
h
2

f  x0 , y0  + f  x1 , y11  
3rd approximation (3rd modification)

y1 3 = y0 +
h
2
 
f  x0 , y0  + f  x1 , y1 2  

…etc

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

Note:1) First we decide to do the problem in one stage or in two stages depending
on the asking value of y at x1  x0  h or x2  x0  2h

2) If h is not given, find by using h  x1  x0  x2  x1  ...

3) To perform 2nd stage of the problem by taking x1  x0 and y1  y0 then use same
set of formula

Working Rule:

dy
Given x0 , y0 and  f ( x, y )
dx

First we find y1   y0  hf  x0 , y0  using Euler’s formula


0

Then find 1st approximation using y1   y0 


1 h
2
 
f  x0 , y0   f  x1 , y10 

Just replace y1  by y1  we get 2nd approximation


0 1

y1 2  y0 
h
2
 
f  x0 , y0   f  x1 , y11 


and etc.

Finally we get y1  x1 

To find y2  x2  in 2nd stage we use same set of formula but taking


x1  x0 and y1  y0 obtained values in 1st stage and continue the same procedure

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

Problems:

dy
1) Use Modified Euler’s method to solve = x + y with y  0  = 1 at x = 0.1
dx
for three iterations, taking h = 0.1

Solution:

Given f  x, y   x  y , x0  0, y0  1, h  0.1and x1  x0  h  0  0.1  0.1

0.1isthe asking value, then we find only y inone stage 


1

y10  y0  hf  x0 , y0   1   0.1 f  0,1  1.1

y11  y0 
h
2
 
f  x0 , y0   f  x1 , y10 

 0.1 f 0,1  f 0.1,1.1  1.11


1 
2
    

h
y1 2  y0 
2
 
f  x0 , y0   f  x1 , y11 

 0.1 f 0,1  f 0.1,1.11  1.1105


1 
2
    

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.1 f 0,1  f 0.1,1.1105  1.1105


 1
2
    

Hence

y  0.1 = 1.1105
dy y + x
2) Solve by Euler’s modified to obtain y  1.2  given that = with
dx y - x
y  1 = 2 carryout three modification

Solution:

yx
Given f  x, y   , x0  1, y0  2, x1  1.2 and h  x1  x0  0.2
yx

1.2 isthe asking value, then we find only y inone stage 


1

y10  y0  hf  x0 , y0   2   0.2  f 1, 2   2.6

h
y11  y0 
2
 
f  x0 , y0   f  x1 , y1 0 

 0.2  f 1, 2  f 1.2, 2.6  2.5714


2 
2
    

h
y1 2  y0 
2
 
f  x0 , y0   f  x1 , y11 

 0.2  f 1, 2  f 1.2, 2.5714  2.5750


2
2
    

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

h
y13  y0 
2
 
f  x0 , y0   f  x1 , y1 2 

 0.2  f 1, 2  f 1.2, 2.5750  2.5745


2
2
    

Hence

y 1.2  = 2.5745
dy y
3) Given = 1+ , y = 2 at x = 1 . Find ‘y’ at x=1.4 by taking h=0.2.
dx x
Applying Modified Euler’s Method.
Solution: Given

y
f  x, y   1  , x0  1, y0  2, h  0.2, x1  x0  h  1  0.2  1.2,
x
x2  x1  h  1.2  0.2  1.4
 find both y1 and y2 in two stage 

First stage:

y10  y0  hf  x0 , y0   2   0.2  f 1, 2   2.6

y11  y0 
h
2
 
f  x0 , y0   f  x1 , y1 0 

 0.2  f 1, 2  f 1.2, 2.6  2.6167


2
2
    

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y1 2  y0 
h
2

f  x0 , y0   f  x1 , y11  
 0.2 
2
2
 f 1, 2   f 1.2, 2.6167   2.6181

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.2 
2 
2
 f 1, 2   f 1.2, 2.6181  2.6182

 y(1.2)  2.6182

Second stage: take


y
f  x, y   1  , x0  1.2, y0  2.6182, h  0.2 and x1  1.4
x

y10  y0  hf  x0 , y0 

y10  2.6182  0.2 f 1.2, 2.6182   3.2546

h
y11  y0 
2

f  x0 , y0   f  x1 , y1 0  
 0.2  f 1.2, 2.6182  f 1.4,3.2546  3.2689
 2.6182 
2
    

h
y1 2  y0 
2

f  x0 , y0   f  x1 , y11  
 0.2  f 1.2, 2.6182  f 1.4,3.2689  3.2699
 2.6182 
2
    

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.2  f 1.2, 2.6182  f 1.4,3.2699  3.2699


 2.6182 
2
    
 y (1.4)  3.2699

dy = x - y 2 , y 0 = 1
4) Solve   at x = 0.2 correct to four decimal places,
dx
by taking h=0.1. Use Modified Euler’s Method.
Solution: Given

f  x, y   x  y 2 , x0  0, y0  1, h  0.1 and x1  x0  h  0.1


x2  x1  h  0.2

 find y1 and y2

First stage: y10  y0  hf  x0 , y0   1   0.1 f  0,1  0.9

y11  y0 
h
2
 
f  x0 , y0   f  x1 , y10 

 0.1 f 0,1  f 0.1,0.9  0.9145


1 
2
    

h
y1 2  y0 
2
 
f  x0 , y0   f  x1 , y11 

 0.1 f 0,1  f 0.1,0.9145  0.9132


1 
2
    

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.1 f 0,1  f 0.1,0.9133  0.9133


1 
2
    

Second stage: take


f  x, y   x  y 2 , x0  0.1, y0  0.9133, h  0.1 and x1  0.2

y10  y0  hf  x0 , y0   0.9133   0.1 f  0.1,0.9133  0.8399

h
y11  y0 
2
 
f  x0 , y0   f  x1 , y10 

 0.1 f 0.1,0.9133  f 0.2,0.8399  0.8513


 0.9133 
2
    

h
y1 2  y0 
2
 
f  x0 , y0   f  x1 , y11 

 0.1 f 0.1,0.9133  f 0.2,0.8513  0.8504


 0.9133 
2
    

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.1 f 0.1, 0.9133  f 0.2, 0.8504  0.8504


 0.9133 
2
    

 y(0.2)  0.8504

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

5) Solve dy = x + y in the range 0 ≤ x ≤ 0.4 by taking h=0.2 given


dx
that y = 1 at x = 0 initially by using Modified Euler’s Method.

Solution: Given

f  x, y   x  y , x0  0, y0  1, h  0.2 and x1  x0  h  0.2


x2  x1  h  0.4

 find both y1 and y2

First stage:

y10  y0  hf  x0 , y0   1   0.2  f  0,1  1.2

y11  y0 
h
2
 
f  x0 , y0   f  x1 , y1 0 

 0.2  f 0,1  f 0.2,1.2  1.2295


1 
2
    

h
y1 2  y0 
2
 
f  x0 , y0   f  x1 , y11 

 0.2  f 0,1  f 0.2,1.2295  1.2309


1 
2
    

y13  y0 
h
2
 
f  x0 , y0   f  x1 , y1 2 

 0.2  f 0,1  f 0.2,1.2309  1.2309


1 
2
    

 y(0.2)  1.2309

Second stage: take


Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

f  x, y   x  y , x0  0.2, y0  1.2309, h  0.2 and x1  0.4

f  x, y   x  y , x0  0.2, y0  1.2309, h  0.2 and x1  0.4

y1 0  y0  hf  x0 , y0   1.2309   0.2  f  0.2,1.2309   1.4928

h
y11  y0 
2
 
f  x0 , y0   f  x1 , y1 0 

 0.2  f 0.2,1.2309  f 0.4,1.4928  1.524


1.2309 
2
    

h
y1 2  y0 
2

f  x0 , y0   f

 0.2  f 0.
1.2309 
2
 

yy 
1
3

0 2
h
0 0
f x ,y  f x ,y  
1 1
2
  
 0.2 
1.2309 
2
 f  0.2,1.2309   f  0.4,1.5253  1.5253

 y (0.4)  1.5253

Practices Problems:

1) Solve y '( x)  3x  y , y(0)  1 then find y(0.2) with h  0.2 . Using


2
modified Euler’s method.
Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

2) Using Modified Euler’s method find y(20.2) and y(20.4) , given


 
that y '( x)  log10  x  and y(20)  5 taking h  0.2
 y
3) Using Modified Euler’s method find y(0.1) , given that
y '( x)  x2  y , y(0)  1 taking h  0.05 considering accuracy up to
two approximations in each step.
4) Find y(0.2) and y(0.4) given dy  x  y, y(0)  1 using Modified
dx
Euler’s method by taking h  0.2
5) Solve dy   xy2 at x  0.1 and x  0.2 with y(0)  2 take h  0.1
dx
and carry out two modifications at each step.
dy
6) Given  x  sin y : y(0)  1 .Compute y(0.4) with h  0.2 using
dx
Euler’s modified method.

RUNGE-KUTTA METHOD OF FOURTH ORDER

The Taylor’s series method of solving differential equations numerically


requires higher order derivatives. But Runge – Kutta method which does
not requires the calculations of higher order derivatives.
Consider the initial value problem
dy  f ( x, y) with y( x )  y
dx 0 0

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

Then find ' y ' at x  x0  h, x2  x0  2h,...


1

i.e. y(x1 ) = y0 +
1
6
k1 +2k2 +2k3 +k4 

Where
k1 = hf(x0 , y0 )

h k
k2 = hf(x0 + , y0 + 1 )
2 2

h k
k3 = hf(x0 + , y0 + 2 )
2 2

k4 = hf(x0 + h , y0 + k3 )

Problems:
dy = x + y, x = 0, y = 1at x = 0.2
1) Solve . Using Runge-Kutta method,
dx
take h=0.2
Solution:
Given f ( x, y)  x  y, x  0, y  1, h  0.2
0 0

y( x  h)  y  1 (k  2k  2k  k )  (1)
0 0 6 1 2 3 4
Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

k  hf ( x0 , y0 )  (0.2) f (0,1)  0.2


1

h k1
k2  hf ( x0  , y0  )  0.2 f (0.1,1.1)  0.24
2 2

h k2
k3  hf ( x0  , y0  )  (0.2) f (0.1,1.12)  0.244
2 2

k4  hf ( x0  h, y0  k3)  (0.2) f (0.2,1.244)  0.2888

1
 (1)  y (0.2)  1  0.2  2(0.24)  2(0.244)  0.2888
6
y(0.2)  1.2428

2) Using Runge-Kutta method of fourth order, find y (0.2) for the


dy y - x
equation = , y(0)= 1 taking h  0.2
dx y + x

Solution:
yx
Given f ( x, y )  , x  0, y  1, h  0.2
yx 0 0

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y( x  h)  y  1 (k  2k  2k  k )  (1)
0 0 6 1 2 3 4

k  hf ( x0 , y0 )  (0.2) f (0,1)  0.2


1

h k1
k2  hf ( x0  , y0  )  0.2 f (0.1,1.1)  0.1667
2 2

h k2
k3  hf ( x0  , y0  )  (0.2) f (0.1,1.0835)  0.1662
2 2

k4  hf ( x0  h, y0  k3)  (0.2) f (0.2,1.1662)  0.1414

1
 (1)  y (0.2)  1  0.2  2(0.1667)  2(0.1662)  0.1414
6
y(0.2)  1.1679

3) Using fourth order Runge-Kutta method, to solve


dy y 2 - x 2
= , y(0)= 1 at the point x  0.2 taking h  0.2
dx y 2 + x 2

Solution:

y 2  x2
Given f ( x, y )  2 , x  0, y  1, h  0.2
y  x2 0 0

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y( x  h)  y  1 (k  2k  2k  k )  (1)
0 0 6 1 2 3 4

k  hf ( x0 , y0 )  (0.2) f (0,1)  0.2


1

h k1
k2  hf ( x0  , y0  )  0.2 f (0.1,1.1)  0.1967
2 2

h k2
k3  hf ( x0  , y0  )  (0.2) f (0.1,1.0984)  0.1967
2 2

k4  hf ( x0  h, y0  k3)  (0.2) f (0.2,1.1967)  0.1891

1
 (1)  y (0.2)  1  0.2  2(0.1967)  2(0.1967)  0.1891
6
y(0.2)  1.1960

4) Using Runge-Kutta method of fourth order, find y (0.1) from


y' = x 2 + y , y(0)= -1

Solution:
Given f ( x, y )  x 2  y , x0  0, y0  1, h  x1  x0  0.1  0  0.1

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y( x1 )  y  1 (k  2k  2k  k )  (1)
0 6 1 2 3 4

k  hf ( x0 , y0 )  (0.1) f (0, 1)  0.1


1

h k1
k2  hf ( x0  , y0  )  (0.1) f (0.05, 1.05)  0.1047
2 2

h k2
k3  hf ( x0  , y0  )  (0.1) f (0.05, 1.0523)  0.1049
2 2

k4  hf ( x0  h, y0  k3)  (0.1) f (0.1, 1.1049)  0.1094

1
 (1)  y (0.1)  1   0.1  2(0.1047)  2(0.1049)  (0.1094)
6

y(0.1)   1.1047

5) Using Runge-Kutta method of fourth order by taking h  0.2 .


dy y
Find y (0.2) from = 3x + , y(0)= 1
dx 2
Solution:

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y
Given f ( x, y )  3x  , x  0, y  1, h  0.2
2 0 0

y( x1 )  y  1 (k  2k  2k  k )  (1)
0 6 1 2 3 4

k  hf ( x0 , y0 )  (0.2) f (0,1)  0.1


1

h k1
k2  hf ( x0  , y0  )  (0.2) f (0.1,1.05)  0.165
2 2

h k2
k3  hf ( x0  , y0  )  (0.2) f (0.1,1.0825)  0.1682
2 2

k4  hf ( x0  h, y0  k3)  (0.2) f (0.2,1.1682)  0.2368

1
 (1)  y (0.2)  1  0.1  2(0.165)  2(0.1682)  (0.2368)
6

y(0.2)  1.1672

Practice Problems:

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

dy
1) Use Runge–Kutta method of fourth order, solve ( x  y ) 1
dx
y(0.4)  1, h  0.1 . Find ' y ' at x  0.5 . Correct to four decimal
places.
dy
2) Use Runge–Kutta method of fourth order, solve  x  y 2 with
dx
y(0)  1. Find ' y ' at x  0.1 taking h  0.1
dy
3) Use Runge–Kutta method of fourth order, solve  xy1/ 3 with
dx
y(1)  1 . Find y(1.1)
dy
4) Use Runge–Kutta method of fourth order, solve  3e x  2 y with
dx
y(0)  0 . Find y (0.1) taking step length h  0.1
dy
5) Use Runge–Kutta method of fourth order  y  2 x at x  1.1 given
dx
that y  3 at x  1
6) Apply Runge–Kutta method of fourth order, to find y (0.1)
dy
 y  xy 2  0, y (0)  1 taking h  0.1
dx

MILNE’S PREDICTOR AND CORRECTOR METHOD

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

dy
Consider the initial value problem  f ( x, y ) with
dx
x x0 x1 x2 x3
y y0 y1 y2 y3

Then find y4 at given x4 using Milne’s method.

Predictor Formula:
4h
y4 (p) = y0 +2f1 - f 2 + 2f 3  where f 1 = f(x1 , y1 ), f 2 = f(x2 , y2 ), f 3 = f(x3 , y3 )
3
To improve this value, we use corrector formula.
Corrector Formula:

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p)  where f 4 (p) = f(x4 , y4 (p) )

Note: 1) If x4 and y4 values are given in the table, then we have to find y5
at given x5 by using
4h
y5 (p) = y1 + 2f 2 - f 3 + 2f 4  where f 2 = f(x2 , y2 ), f 3 = f(x 3 , y3 ), f 4 = f(x4 , y4 )
3

y5 (c) = y3 +
h
3
 f 3 + 4f 4 + f 5 (p)  where f 5 (p) = f(x5 , y5 (p) )

(OR) If x4 and y4 values are given in the table, then ignore x0 and y0 from
the given data then we use same set of formulas and find y4( p ) & y4( c )

2) To find f1 , f 2 , f3 & f 4 ( p ) , we form the table


Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

x y f ( x, y )
x0 y0 f0  f ( x0 , y0 )
x1 y1 f1  f ( x1 , y1 )
x2 y2 f 2  f ( x2 , y2 )
x3 y3 f3  f ( x3 , y3 )
x4 y4( p ) f 4( p )  f ( x4 , y4( p ) )

3) To improve the required value, we use corrector formula twice,


thrice... until y4 remains unchanged

(by replacing f 4( p ) by f 4(c )  f ( x4 , y4( c ) ) in corrector formula)

Problems:
1) Given
dy
 xy  y 2 , y (0)  1, y (0.1)  1.1169, y (0.2)  1.2773, y (0.3)  1.5049.
dx
Find y (0.4) using Milne’s Predictor-Corrector method.

Solution:

x y f ( x, y )
x0  0 y0  1 f0  1
x1  0.1 y1  1.1169 f1  1.3592
x2  0.2 y2  1.2773 f 2  1.8870
x3  0.3 y3  1.5049 f3  2.7162
x4  0.4 y4( p )  1.8352 f 4( p )  4.1020

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

4h
y4 (p) = y0 + 2f 1 - f 2 + 2f 3 
3
4(0.1)
=1+ 2(1.3592) -1.8870 + 2(2.7162) = 1.8352
3

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p) 

0.1
= 1.2773 + 1.887 + 4(2.7162)+ 4.102  = 1.8391
3
 y(0.4)  1.8391

dy
2) Use Milne’s method find ' y ' at x  0.8 . Given  x  y 2 with
dx
X 0 0.2 0.4 0.6
Y 0 0.02 0.0795 0.1762

Solution:

x y f ( x, y )
x0  0 y0  0 f0  0
x1  0.2 y1  0.02 f1  0.1996
x2  0.4 y2  0.0795 f 2  0.3937
x3  0.6 y3  0.1762 f3  0.5690
x4  0.8 y4( p )  0.3050 f 4( p )  0.7070

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

4h 4(0.2)
y4 (p) = y0 + 2f1 - f 2 + 2f 3  = 0 + 2(0.1996) - 0.3937 + 2(0.569)
3 3
 0.3050

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p) 

0.2
= 0.0795 + 0.3937 + 4(0.569)+ 0.707   0.3046
3
 y(0.8) = 0.3046
1
3) If y '  , y (0)  2, y (0.2)  2.0933, y (0.4)  2.1755, y (0.6)  2.2493.
x y
Find y  0.8 byMilne'smethod
Solution:

x y 1
f ( x, y ) 
x y
x0  0 y0  2 f0  0.5
x1  0.2 y1  2.0933 f1  0.4360
x2  0.4 y2  2.1755 f 2  0.3882
x3  0.6 y3  2.2493 f3  0.3509
x4  0.8 y4( p )  2.3161 f 4( p )  0.3209

4h
y4 (p) = y0 + 2f 1 - f 2 + 2f 3 
3

4(0.2)
=2+ 2(0.436) - 0.3882 + 2(0.3509)  2.3161
3

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p) 

0.2
= 2.1755 + 0.3882 + 4(0.3509)+ 0.3209   2.3163
3
 y(0.8) = 2.3163

dy
4) If dx  2e x
 y, y (0)  2, y (0.1)  2.01, y (0.2)  2.04, y (0.3)  2.09

Find y  0.4  Correct to four decimal places by using Milne’s Predictor-


Corrector method.

Solution:

x y f ( x, y )  2e x  y
x0  0 y0  2 f0  0
x1  0.1 y1  2.01 f1  0.2003
x2  0.2 y2  2.04 f 2  0.4028
x3  0.3 y3  2.09 f3  0.6097
x4  0.4 y4( p )  2.1622 f 4( p )  0.8214

4h
y4 (p) = y0 + 2f 1 - f 2 + 2f 3 
3
4(0.1)
=2+ 2(0.2003) - 0.4028 + 2(0.6097)  2.1622
3

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p) 

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

0.1
= 2.04 + 0.4028 + 4(0.6097)+ 0.8214   2.1621
3

 y(0.4) = 2.1621

5) The following table gives the solution of 5 xy'  y 2  2  0 . Find the value
of 'y' at x = 4.5 using Milne’s Predictor – Corrector method

X 4 4.1 4.2 4.3 4.4


y 1 1.0049 1.0097 1.0143 1.0187

Solution:

2  y2
x y f ( x, y ) 
5x
x0  4.1 y0  1.0049 f0  0.0483
x1  4.2 y1  1.0097 f1  0.0466
x2  4.3 y2  1.0143 f 2  0.0452
x3  4.4 y3  1.0187 f3  0.0437
x4  4.5 y4( p )  1.0229 f 4( p )  0.0425

4h
y4 (p) = y0 + 2f 1 - f 2 + 2f 3 
3
4(0.1)
=1.0049 + 2(0.0466) - 0.0452 + 2(0.0437)  1.0229
3

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

y4 (c) = y2 +
h
3
 f 2 + 4f 3 + f 4 (p) 

0.1
=1.0143 + 0.0452 + 4(0.0437)+ 0.0425   1.0230
3

 y(0.4) = 1.0230
Practice Problems:

1) Apply Milne’s method to compute y (1.4) correct to four decimal


dy y
places, given  x 2  and the following data
dx 2
x 1 1.1 1.2 1.3
y 2 2.2156 2.4649 2.7514

2) Given
dy x  y
 , y (0)  2, y (0.5)  2.636, y(1)  3.595, y(1.5)  4.968
dx 2
Then find the value of y at x  2 using Milne’s predictor and
corrector formula
3) Apply Milne’s method, find y (2) given that
dy y
 2 , y (1)  2, y (1.25)  3.13, y (1.5)  4.5, y (1.75)  6.13
dx x
4) Use Milne’s method, find y (0.4) given that
dy
 x  y 2 , y (0)  1, y (0.1)  1.1, y (0.2)  1.231, y (0.3)  1.402
dx

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

5) Apply Milne’s method, find y (0.4) given that


dy
 2e x y , y (0)  2.4, y (0.1)  2.473, y (0.2)  3.129, y (0.3)  4.059
dx

ADAMS-BASHFORTH METHOD
dy
Consider the initial value problem  f ( x, y ) with
dx
x x0 x1 x2 x3
y y0 y1 y2 y3

Then find y4 at given x4 using Adams-Bashforth predictor and corrector


formula.

Predictor Formula
h
y4 (p) = y3 + 55f 3 - 59f 2 + 37f 1 - 9f0  where f0 = f(x0 , y0 ) f 1 = f(x1 , y1 ),
24
f 2 = f(x2 , y2 ), f 3 = f(x3 , y3 )

to improve this value, we use corrector formula.


Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

Corrector Formula:

y4 (c) = y3 +
h
24
 f 1 - 5f 2 + 19f 3 + 9f 4(p)  where f 4 (p) = f(x4 , y4 (p) )

Problems:
1) Given
dy
 x 2 (1  y ) , y (1)  1, y (1.1)  1.233, y (1.2)  1.548, y (1.3)  1.979
dx
Then evaluate y (1.4) using Adams-Bashforth method

Solution:

x y f ( x, y )  x 2 (1  y )
x0  1 y0  1 f0  2
x1  1.1 y1  1.233 f1  2.7019
x2  1.2 y2  1.548 f 2  3.6691
x3  1.3 y3  1.979 f3  5.0345
x4  1.4 y4( p )  2.5723 f 4( p )  7.0017

h
y4 (p) = y3 + 55f 3 - 59f 2 + 37f 1 - 9f0 
24
Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT
Bangalore Institute of Technology

(0.1)
=1.979 + 55(5.0345) - 59(3.6691) + 37(2.7019) - 9(2)
24
 2.5723

y4 (c) = y3 +
h
24
 f 1 - 5f 2 + 19f 3 + 9f 4(p) 

(0.1)
=1.979 + (2.7019) - 5(3.6691) +19(5.0345) + 9(7.0017)
24
 2.5749
∴ y(1.4 )
= 2.5749

2) Using Adams-Bashforth method find y at x  0.4 given


dy
 x 2  y , y (0)  1, y (0.1)  0.9051, y (0.2)  0.8212, y(0.3)  0.7492
dx

Solution:

x y f ( x, y )  x 2  y
x0  0 y0  1 f 0  1
x1  0.1 y1  0.9051 f1  0.8951
x2  0.2 y2  0.8212 f 2  0.7812
x3  0.3 y3  0.7492 f3  0.6592
x4  0.4 y4( p )  0.6897 f 4( p )  0.5290

h
y4 (p) = y3 + 55f 3 - 59f 2 + 37f 1 - 9f0 
24

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

(0.1)
= 0.7492 + 55(-0.6592) - 59(-0.7812) + 37(-0.8951) - 9(-1)
24
 0.6897

y4 (c) = y3 +
h
24
 f 1 - 5f 2 + 19f 3 + 9f 4(p) 

(0.1)
= 0.7492 + (-0.8951) - 5(-0.7812) +19(-0.6592) + 9(-0.5290)
24
 0.6897
∴ y(0.4 )
= 0.6897

3) Using Adams-Bashforth method find y (0.4) given


y'  y  xy 2  0, y(0)  1, y(0.1)  0.9008, y(0.2)  0.8066, y(0.3)  0.722
Apply corrector formula twice.

Solution:

x y f ( x, y )  x 2  y
x0  0 y0  1 f 0  1
x1  0.1 y  0.9008 f1  0.9819
1
x2  0.2 y2  0.8066 f 2  0.9367
x3  0.3 y3  0.722 f 3  0.8784
x4  0.4 y4  0.6370 f 4  0.7993

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

h
y4 (p) = y3 + 55f 3 - 59f 2 + 37f 1 - 9f0 
24

24  
 0.722 
0.1 55(0.8784)  59(0.9367)  37(0.9819)  9(1)

 0.6370

y4 (c) = y3 +
h
24
 f 1 - 5f 2 + 19f 3 + 9f 4(p) 

 0.722  0.10.9819  5(0.9367) 19(0.8784)  9(0.7993)


24
 0.6380
 y(0.4)  0.6380

Applying the corrector formula again,

f (c)  f ( x 4 , y4(c) )  0.8008


4

4 3 24 1 
y(c)  y  h f  5 f 19 f  9 f 4(c)
2 3 
 0.6380

 y(0.4)  0.6380

Practice Problems:

1) Using Adams-Bashforth method, find y at x  0.8 given


dy
 x  y2 , y(0)  0, y(0.2)  0.02, y(0.4)  0.0795, y(0.6)  0.1762
dx
Apply corrector formula twice.

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT


Bangalore Institute of Technology

dy 1
2) Using Adams-Bashforth method, find y (0.4) from  xy with
dx 2
y(0)  1, y(0.1)  1.0025, y(0.2)  1.0101, y(0.3)  1.0228 .

3) Using Adams-Bashforth method, find y at x  0.4 given that

dy
 2 yex with y(0)  2, y(0.1)  2.4, y(0.2)  2.473, y(0.3)  3.129
dx
4) Using Adams-Bashforth method, find y(4.4) given that

 dy  2
5x    y  2 with
 
dx
X 4 4.1 4.2 4.3
y 1 1.0049 1.0097 1.0143

Dr.Dinesh A C, Associate Professor, Dept. of Mathematics, BIT

You might also like