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

B.M.S.

COLLEGE OF ENGINEERING, BENGALURU – 560 0 19


Autonomous college, affiliated to VTU
DEPARTMENT OF MATHEMATICS

Mathematical Foundations for Mechanical Engineering Stream-2


Mathematical Foundation for Computer Science Stream-2
Mathematical Foundation for Civil Engineering -2
Mathematical Foundation for Electrical Stream-2
(Course Code: 22MA2BSMES, 22MA2BSMCS, 22MA2BSMCV, 22MA2BSMME)
UNIT-5: NUMERICAL METHODS – 2
Numerical Solution of Ordinary Differential Equations (ODE’S)
Numerical Solution of Ordinary Differential Equations of First Order and First Degree:
An ODE of the first order is of the form F ( x, y, y ) = 0 .
An initial value problem is of the form y = f ( x, y ) , with y( x0 ) = y0 given and we assume
that the problem has a unique solution on some open interval a  x  b containing x0 .
I Taylor’s series method
Consider y = f ( x, y ) ---- (1)
Differentiating Equation (1), we get y = f x + f y f  . Similarly, by successive differentiation
we obtain higher order derivatives of y . Substituting y( x0 ) = y0 we obtain the values of

( x − x0 )2
( y)0 , ( y)0 etc. Hence the Taylor’s series y( x) = y0 + ( x − x0 ) ( y )0 + ( y )0 + ...
2!
gives the values of y for every value of x for which the series converges.
Problems:

Using Taylor’s method approximate the solution of the following initial value problems

1) Approximate the value of y at x = 0.1 and x = 0.2 to five decimals from


dy
= x 2 y − 1, y ( 0 ) = 1 . Ans: y ( 0.1) = 0.90033, y ( 0.2 ) = 0.80227
dx
2) Obtain approximate value of y at x = 0.2 for the differential equation
dy
= 2 y + 3e x , y ( 0 ) = 0 . Compare the numerical solution obtained with the exact solution
dx
upto three decimal places. Ans: 0.811
dy
3) Given = log e ( xy), y (1) = 2 . Approximate y(1.1) and y(1.2)
dx
y (1.1) = 2.036, y (1.2 ) = 2.081
Ans:
dy
4) Find an approximate value of y when x = 0.1 if = x − y 2 and y = 1 at x = 0 .
dx
Ans: 0.1938
5) Given y = x + y, y(1) = 0. Find y(1.1) and y(1.2) . Compare the result with its exact
value. Ans: y (1.1) = 0.1103, y (1.2 ) = 0.2428

Dept of Mathematics, BMSCE Page 1 of 6


Unit-5 Numerical Methods-2

6) Evaluate y(0.1) correct to 4 decimal places if y ( x) satisfies y = xy + 1, y(0) = 1.


Ans: 1.1053
7) Given y = 3x + y 2 , y (0) = 1 compute y(0.1) . Ans:1.1272
dy
8) Find y(0.1) correct to 3-decimal places given that = e x − y2 , y ( 0 ) = 1 . Ans:1.005
dx
II Modified Euler’s Method
= f (x, y ) with y ( x0 ) = y0 and taking h as the step length.
dy
Consider
dx
Then x1 = x0 + h , y1 = ?
To find y1 use Modified Euler’s formula which is given below:
y1P = y0 + h f ( x0 , y0 )

y1(1) = y 0 +
h
2
 
f (x0 , y 0 ) + f (x1 , y1E ) where y1(1) is known as the first modified value of y1

 
y1(2 ) = y 0 + f (x0 , y 0 ) + f (x1 , y1(1) ) , y1(2) is known as the second modified value of y1
h
2
 
y1(3) = y 0 + f (x0 , y 0 ) + f (x1 , y1(2 ) ) , y1(3) is known as the third modified value of y1
h
2
.
.
h
2
 
y1(n ) = y 0 + f (x0 , y 0 ) + f (x1 , y1(n −1) ) , y1( ) is known as the n th modified value of y1
n

----------------------------------------------------------------------------------------------------------------
Then, x 2 = x1 + h , y 2 = ?
To find y 2 use Modified Euler’s formula which is given below:
y2P = y1 + h f ( x1 , y1 ) ,

y 2(1) = y1 + h
2

f (x1 , y1 ) + f (x 2 , y 2E ) , y 2(1) is known as the first modified value of y 2

 
y 2(2 ) = y1 + f (x1 , y1 ) + f (x 2 , y 2(1) ) , y2(2) is known as the second modified value of y 2
h
2
 
y 2(3) = y1 + f (x1 , y1 ) + f (x2 , y 2(2 ) ) , y2(3) is known as the third modified value of y 2
h
2
.
.
 
y 2(n ) = y1 + f (x1 , y1 ) + f (x2 , y 2(n −1) ) , y2(n ) is known as the n th modified value of y 2
h
2
Similarly, we can find the values of y3 , y4 , ...

Dept of Mathematics, BMSCE Page 2 of 6


Unit-5 Numerical Methods-2

Problems:

Solve the following differential equations using Modified Euler’s method:

1) y = x + y , y ( 0 ) = 1 at x = 0.1 and x = 0.2 with h = 0.1 .


Ans: y(0.1) = 1.1105, y(0.2) = 1.2432
2) y = y + e x , y (0) = 0 at x = 0.2 . Take h = 0.2 . Ans: y ( 0.2) = 0.2468
3) y = log ( x + y ) , y ( 0) = 2 at x = 0.4 . Take h = 0.2 .
Ans: y ( 0.2) = 2.0656, y ( 0.4) = 2.1416
4) y = 1 − y, y(0) = 0 at x = 0.1 and x = 0.2 with h = 0.1 .
Ans: y ( 0.1) = 0.095 y ( 0.2) = 0.181
5) y = x + sin y , y ( 0 ) = 1 . Compute y ( 0.2 ) and y ( 0.4 ) .
Ans: y ( 0.2) = 1.2046, y ( 0.4) = 1.4644
6) dy = y − x with the boundary conditions y = 1 when x = 0 , find approximately y
dx y+x
for x = 0.1 Ans: y ( 0.1) = 1.0928

= x 2 + y and y = 1 when x = 0 . Find an approximate value of y ( 0.1) taking


dy
7) Given
dx
h = 0.05 . Ans: y ( 0.1) = 2.2352
8) y = x + y and y = 1 when x = 0 for 0.2 ( 0.2) 0.4 .

Ans: y ( 0.2) = 1.2309, y ( 0.4) = 1.5253


9) Intensity of radiation is directly proportional to the amount of remaining radioactive
dy
substance. The differential equation is = −ky , where k = 0.01, t0 = 0, y0 = 100 g .
dt

Dept of Mathematics, BMSCE Page 3 of 6


Unit-5 Numerical Methods-2

Determine how much substance will remain at the moment t = 50 sec by Modified
Euler’s method with h = 25.
III Runge-Kutta method of fourth-order
= f (x, y ) with y ( x0 ) = y0 and taking h as the step length.
dy
Consider
dx
Then, x1 = x0 + h , y1 = ?
To find y1 use the Runge-Kutta formula which is given below:

y1 = y0 + k where k =
1
(k1 + 2k 2 + 2k 3 + k 4 ) ,
6
 h k 
k1 = h f ( x0 , y0 ) , k 2 = h f  x0 + , y 0 + 1  ,
 2 2
 h k 
k 3 = h f  x 0 + , y 0 + 2  , k 4 = h f ( x0 + h , y 0 + k 3 ) .
 2 2
----------------------------------------------------------------------------------------
Then, x 2 = x1 + h , y 2 = ?
To find y 2 use the Runge-Kutta formula which is given below:

y2 = y1 + k where k =
1
(k1 + 2k 2 + 2k 3 + k 4 ) ,
6
 h k 
k1 = h f (x1 , y1 ) , k 2 = h f  x1 + , y1 + 1  ,
 2 2
 h k 
k 3 = h f  x1 + , y1 + 2  , k 4 = h f (x1 + h , y1 + k3 ) .
 2 2
Similarly, we can find the values of y3 , y4 , ...

Dept of Mathematics, BMSCE Page 4 of 6


Unit-5 Numerical Methods-2

Problems:
Solve the following differential equations using Runge-Kutta method of fourth-order:
1) y = x + y , y ( 0 ) = 1 at x = 0.2 Ans: y(0.2) = 1.2428

2) ( x + y ) y = 1 , y ( 0.4) = 1 at x = 0.5

dy y 2 − x 2
3) = with y ( 0 ) = 1 at x = 0.2 and 0.4 . Ans: y(0.2) = 1.196, y(0.4) = 1.3752
dx y 2 + x 2
4) y = x + y 2 , y ( 0) = 1 at x = 0.2 in steps of 0.1 Ans: y(0.1) = 1.1165, y(0.2) = 1.2736
dy 2 xy + e x
5) = with y (1) = 0 at x = 1.2 Ans: y(1.2) = 0.1402
dx x 2 + xe x
6) y = 3x + y 2 at x = 1.1 , given that y = 1.2 when x = 1 Ans: y(1.1) = 1.7278

7) y  = 3x + , y ( 0 ) = 1 at x = 0.2 taking h = 0.1 Ans: y(0.2) = 1.1749


y
2
dy y − x
8) = , y ( 0 ) = 1 at x = 0.2 taking h = 0.2 Ans: y(0.2) = 1.1678
dx y + x

IV Milne’s predictor-corrector formula

= f (x, y ) with y ( x0 ) = y0 and taking h as the step length.


dy
Consider
dx
Given y0 = y ( x0 ) , we compute y1 = y ( x0 + h ) , y2 = y ( x0 + 2h ) , y3 = y ( x0 + 3h ) by Euler’s
formula yk +1 = yk + h f ( xk , yk ) . [or values are given by Taylor’s series method or Runge-
Kutta method of Fourth order]
Next we calculate f 0 = f ( x0 , y0 ) , f1 = f ( x1 , y1 ) , f 2 = f ( x2 , y2 ) and f 3 = f ( x3 , y3 ) .
To find y4 :
4h
y4( P ) = y0 + ( 2 f1 − f 2 + 2 f3 ) which is called a Predictor formula.
3
(
Now we find first approximation to f 4 = f x0 + 4h, y4 ( P ) . )
The better value of y4 is found by
h
y4(C ) = y2 +( f 2 + 4 f3 + f 4 ) which is called a Corrector formula.
3
Then an improved value of f 4 is computed and again the corrector is applied to find a still
better value of y4 remains unchanged. Once y4 and f 4 are obtained to desired degree of
4h
accuracy, y5 = y ( x0 + 5h ) is found from the predictor as y5( P ) = y1 + ( 2 f 2 − f3 + 2 f 4 ) and
3

Dept of Mathematics, BMSCE Page 5 of 6


Unit-5 Numerical Methods-2

f5 is calculated. Then a better approximation to the value of y5 is obtained from the


h
corrector y5(C ) = y3 + ( f3 + 4 f 4 + f5 ) .
3
Problems:
dy
1) Given = x3 + y, y (0) = 2. The value of y(0.2) = 2.073 , y(0.4) = 2.452 and
dx
y(0.6) = 3.023 are got by Runge-Kutta method of Fourth order. Find y(0.8) by
Milne’s predictor-corrector method taking h = 0.2 . Ans: y(0.8) = 3.795
dy
2) Given 2 = (1 + x 2 ) y 2 and y(0) = 1, y(0.1) = 1.06 , y(0.2) = 1.12, y(0.3) = 1.21,
dx
evaluate y(0.4) by Milne’s predictor-corrector method. Ans: y(0.4) = 1.2797

3) From the data given below, find y at x = 1.4 , using Milne’s predictor-corrector
dy y
formula: = x2 + x 1 1.1 1.2 1.3
dx 2 y 2 2.2156 2.4549 2.7514

Ans: y(1.4) = 3.0794


dy
4) If = 2e x − y, y (0) = 2 , y(0.1) = 2.010 , y(0.2) = 2.04 and y(0.3) = 2.09 ; find
dx
y(0.4) using Milne’s predictor-corrector method. Ans: y(0.4) = 2.162
dy
5) Given = xy + y 2 , y (0) = 1. The value of y(0.1) = 1.1169 , y(0.2) = 1.2773 and
dx
y(0.3) = 1.5049 are got by Runge-Kutta method of Fourth order. Find y(0.4) by
Milne’s predictor-corrector method. Ans: y(0.4) = 1.8391

6) Given y = x( x 2 + y 2 )e− x , y ( 0 ) = 1, compute y(0.4) by Milne’s predictor-corrector


method. The values of y(0.1) = 1.005 , y(0.2) = 1.018 and y(0.3) = 1.04 are obtained
by Taylor’s series method. Ans: y(0.4) = 1.071

Dept of Mathematics, BMSCE Page 6 of 6

You might also like