DR Hashim Khan - Math-410 - Chapter 5
DR Hashim Khan - Math-410 - Chapter 5
Numerical Methods
(For Engineering College Students)
MATH-410
----------------------------------------------------------
Chapter–5: Numerical Solution of Ordinary
Differential Equations
----------------------------------------------------------
Prepared by
Dr Hashim Khan
Email: [email protected]
[email protected]
Contents:
1.10 Exercise 1 26
1.1 Introduction:
Many problems in science and engineering when formulated in mathematical terms lead to
ordinary differential equations with appropriate initial and/or boundary conditions.
For example:
( )
( ) , ( )
( ), , ( ) , ( ) ( )
Let, ( )
𝒅𝒑
𝒇(𝒕 𝒚 𝒑), 𝒑(𝒂) 𝜷
𝒅𝒕
( )
𝒅𝒚
𝒑, 𝒚(𝒂) 𝜶
𝒅𝒕
( ) ( ) , ( ) ( )
Integrating the above ordinary differential equation with respect to from to , we have-
∫ ( ) ∫ ( )
[ ( )] ∫ ( )
( ) ( ) ∫ ( )
( ) ( ) ∫ ( )
This is an integral equation which contains the unknown function under the integral sign.
Thus, the first approximation ( ) to the solution is obtained by replacing to on the R.H.S.
We get-
( )( ) ( ) ∫ ( )
( )( ) ( ) ( )
Similarly, ∫ ( )
Proceeding in this way, we obtain-
( )( ) ( ) ( )
∫ ( )
𝒕
𝒚(𝒏) (𝒕) 𝒚(𝒕𝟎 ) ∫ 𝒇(𝒕 𝒚(𝒏 𝟏)
) 𝒅𝒕
𝒕𝟎
As a matter of fact, the process is stopped when the two successive iterations of are same to the
desired degree of accuracy.
Example 5.2.1: Use Picard’s Iteration Method to find the solution up to 5th approximations to the given
initial value problem and hence obtain ( ).
, , ( ) , with
Solution: We have- ( ) , ( )
( )
* +
( )
( )
* +
( )
( )
* +
( )
( ) ( ) ( )
∫ ( )
( ) ( ) ( ) ( )
∫( ) [ ( ) ]
( )
∫( )
( )
* +
( )
2 ( )
3 ( )
4 ( )
5 ( )
From the table, we observe that 4th and 5th approximations are same up to five decimal places, thus-
𝒚(𝟎 𝟐) 𝟏 𝟐𝟒𝟐𝟖𝟎
is accurate answer up to five decimal places.
Example 5.2.2: Use Picard’s Iteration Method to find the solution up to 3rd approximations to the given
initial value problem and hence obtain ( ).
, , ( )
Solution: We have- ( ) , , ( )
( )
* +
( )
( )
* +
( )
2 ( )
3 ( )
From the table, we observe that 2nd and 3rd approximations are same up to two decimal places, thus-
𝒚(𝟎 𝟐) 𝟏 𝟎𝟏𝟖
is accurate answer up to two decimal places.
Example 5.2.3: Use Picard’s Iteration Method to find the solution up to 3rd approximations
to the given initial value problem and hence obtain ( ) and ( ).
, , ( )
Solution: We have- ( ) , , ( )
( )
* +
( )
( )
* +
( )
2 ( ) ( )
3 ( ) ( )
( ) ( ( )) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
( )
( ) ( ) ( ) ( ) ( ) ( ) ( )
Since is small, therefore and higher terms, being a very small can be deleted.
Thus, we get-
( ) ( ) ( )
( ) ( ) ( ( )) [ ( ) ( ( ))]
𝒚𝒊 𝟏 𝒚𝒊 𝒉𝒇(𝒕𝒊 𝒚𝒊 )
( )
This is called Euler’s Method for solving initial value problem (IVP)
Example 5.3.1: Use Euler’s Method to approximate the solution of given initial value problem at
with
, , ( )
Solution: We have, ( )
( )
[ ] [ ( ) ]
[ ( ) ]
( ) ( )
( )
[ ] [ ( ) ]
[ ( ) ]
( ) ( )
( )
[ ] [ ( ) ]
[ ( ) ]
( ) ( )
( )
[ ] [ ( ) ]
[ ( ) ]
( ) ( )
Example 5.3.2: Apply Euler’s Method to approximate ( ) to the given initial value problem with
, , ( )
Solution: We have, ( )
( )
* + [ ( ) ]
( ) ( )
( )
* + [ ( ) * +]
( ) ( )
( )
* + [ ( ) [ ]]
( ) ( )
( )
* + [ ( ) [ ]]
( ) ( )
( )
* + [ ( ) [ ]]
( ) ( )
( ) ( ) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
( ) ( ) ( ) For,
𝒉
𝒚𝑴𝑬
𝒊 𝟏 𝒚(𝒕𝒊 𝟏 ) 𝒚(𝒕𝒊 ) [𝒇(𝒕𝒊 𝒚𝒊 ) 𝒇(𝒕𝒊 𝟏 𝒚(𝒕𝒊 ) 𝒉𝒇(𝒕𝒊 𝒚𝒊 ))]
𝟐
For,
𝒉
𝒚𝑴𝑬
𝒊 𝟏 𝒚(𝒕𝒊 𝟏 ) 𝒚(𝒕𝒊 ) [𝒇(𝒕𝒊 𝒚𝒊 ) 𝒇(𝒕𝒊 𝟏 𝒚𝑬𝒊 𝟏 )]
𝟐
Example 5.4.1: Use Modified Euler’s Method to find ( ) and ( ) to the given initial value
problem, taking
, , ( )
Solution: We have, ( ) ,
First, ( ) ( )
[ ] [ ( ) ]
[ ( ) ]
Now,
( ) ( ) ( ) [ ( ) ( )]
( ) ( ) ( ) [( ) ( )]
( ) ( ) [( ( ) ) ( ( ) )]
( )
First, ( ) ( )
[ ] [ ( ) ]
[ ( ) ]
Now,
( ) ( ) ( ) [ ( ) ( )]
( ) ( ) ( ) [( ) ( )]
( ( ) )
( ) ( ) [ ]
( ( ) )
( )
Example 5.4.2 Use Modified Euler’s Method to approximate ( ) to the given initial value problem:
, , ( ) ,
Solution: We have, ( ) ,
[ ] [ ( ) ]
( ) [ ( ) ( )]
( ) [( ) ( )]
( )
[ ] [ ( ) ]
( ) [ ( ) ( )]
( ) [( ) ( )]
( )
( ) ( ) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
( )
( ) ( ) ( ) ( ) ( ) ( ) ( )
𝒉𝟐 𝒉𝟑 𝒉𝟒 (𝟒) 𝒉𝒏 (𝒏)
𝒚𝒊 𝟏 𝒚𝒊 𝒉𝒚𝒊 𝒚 𝒚 𝒚 𝒚 ( )
𝟐 𝒊 𝟑 𝒊 𝟒 𝒊 𝒏 𝒊
The equation ( ) is called Taylor’s Series Method of Order n to solve Initial Value
Problem (IVP).
Example 5.5.1: Use Taylor’s Series Method of Order 4 to find ( ) to the given initial
value problem (Taking ).
, , ( )
( ) ( )
( ) ( )
( )
( )
( ) ( )
( )
( )
( )
( ) ( )
( ) ( )( ) ( ) ( )
( )
( )
( )
Example 5.5.2: Use Taylor’s Series Method of order 4 to find ( ) to the given initial
value problem correct to four decimal places (Taking ).
, , ( )
( )( )
( ) ( ) ( ) ( )
( ) ( )
( )( ) ( )( )
( )
( )
( ) ( ) ( )
( ) ( )( ) ( ) ( ) ( )
( )
( ) ( ) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
and * ( ( ) ( ))+
𝑲𝟐 𝒉[𝒇(𝒕𝒊 𝒑𝟏 𝒉 𝒚𝒊 𝒒𝟏 𝑲𝟏 )]
Hence,
𝒚𝒊 𝟏 𝒚𝒊 (𝒂𝟏 𝑲𝟏 𝒂𝟐 𝑲𝟐 )
Heun’s Method:
We get- 𝑲𝟏 𝑲𝟐
𝒚𝒊 𝟏 𝒚𝒊
𝟐
Where, 𝑲𝟏 𝒉𝒇(𝒕𝒊 𝒚𝒊 )
𝑲𝟐 𝒉[𝒇(𝒕𝒊 𝒉 𝒚𝒊 𝑲𝟏 )]
Example 5.7.1: Use Heun’s Method (Second Order Runge-Kutta Method) to find ( ) to the
given initial value problem, with
, , ( )
Solution: We have- ( ) ,
Here- , ( ) and
First, ( )
[ ] [ ( ) ]
[ ( ) ]
Next, [ ( )]
[( ) ( ) ] [ ( ) ( ) ( ) ]
[( ) ( ) ]
Now, ( ) ( )
( ) ( )
Here- , ( ) and
First, ( )
[ ] [ ( ) ]
[ ( ) ]
Next, [ ( )]
[( ) ( ) ] [ ( ) ( ) ( ) ]
[( ) ( ) ]
Now, ( ) ( )
( ) ( )
Example 5.7.2: Use Runge-Kutta Second Order Method to approximate the solution ( )
to the given initial value problem: , , ( ) , with
Solution: We have- ( )
Here- , ( ) ( ) and
( ) ( )
( ) * + * +
( )
( ) ( ) ( ) ( )
[ ( )] *( + * +
) ( ) ( ) ( )
Thus, [ ] * +
( )
Here- , and
( ) ( )
( ) * + * +
( )
( ) ( )
[ ( )] *( +
) ( )
( ) ( )
*( ) (
+
)
Thus, [ ]
[ ]
( )
( ) ( ) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
𝑲𝟏 𝒉𝒇(𝒕𝒊 𝒚𝒊 )
𝒉 𝑲𝟏
𝑲𝟐 𝒉𝒇 𝒕𝒊 𝒚
𝟐 𝒊 𝟐
𝑲𝟐 𝒉𝒇(𝒕𝒊 𝒉 𝒚𝒊 𝑲𝟏 )
𝑲𝟑 𝒉𝒇(𝒕𝒊 𝒉 𝒚𝒊 𝑲𝟐 )
𝟏
Hence, 𝒚𝒊 𝟏 𝒚𝒊 [𝑲 𝟒𝑲𝟐 𝑲𝟑 ]
𝟔 𝟏
Example 5.8.1: Use Runge-Kutta Third Order Method to approximate the solution ( ) to the given
initial value problem and compare the result to the actual values.
, , ( ) , with
Solution: We have- ( )
Here- , ( ) ( ) and
( ) * + * +
( ) ( )
* ( )+ * + * +
( ) ( )
( ) ( )
( ) * + * +
( ) ( )
( ) ( )
( ) [ ] * +
( ) ( )
Thus,
[ ( ) ]
[ ( ) ]
( ) ( )
Comparison
Runge-Kutta Third Order Method Actual values
( ) ( )
( ) ( ) , ( ) ( )
Define, the common distance between the points that is call step size-
( )
𝑲𝟏 𝒉𝒇(𝒕𝒊 𝒚𝒊 )
𝒉 𝑲𝟏
𝑲𝟐 𝒉𝒇 𝒕𝒊 𝒚
𝟐 𝒊 𝟐
𝒉 𝑲𝟐
𝑲𝟑 𝒉𝒇 𝒕𝒊 𝒚
𝟐 𝒊 𝟐
𝑲𝟒 𝒉𝒇(𝒕𝒊 𝒉 𝒚𝒊 𝑲𝟑 )
𝟏
Hence, 𝒚𝒊 𝟏 𝒚𝒊 [𝑲 𝟐(𝑲𝟐 𝑲𝟑 ) 𝑲𝟒 ]
𝟔 𝟏
Example 5.9.1: Use Runge-Kutta Fourth Order Method to find ( ) and ( ) to the given initial
value problem with
, , ( )
Solution: We have- ( ) ,
Here- , ( ) and
( ) [ ] [ ( ) ]
* ( )+ [( ) ( ) ] [( ) ( ) ]
* ( )+ [( ) ( ) ] [( ) ( ) ]
( ) [( ) ( ) ] [( ) ( ) ]
Thus, [ ( ) ] [ ( ) ]
( ) ( )
Here- , ( ) and
( ) [ ] [ ( ) ]
* ( )+ [( ) ( ) ]
[( ) ( ) ]
* ( )+ [( ) ( ) ]
[( ) ( ) ]
( ) [( ) ( ) ]
[( ) ( ) ]
Thus,
[ ( ) ]
( ) ( )
[ ( ) ]
( )
Example 5.9.2: Use Runge-Kutta Fourth Order Method to approximate the solution ( ) to the
given initial value problem and compare the result to the actual values.
, , ( ) , with
Solution: We have- ( )
Here- , ( ) ( ) and
( ) * + * +
( ) ( )
* ( )+ * + * +
( ) ( )
( ) ( )
* ( )+ * + * +
( ) ( )
( ) ( )
( ) * + * +
( ) ( )
Thus, [ ( ) ]
[ ( ) ]
( ) ( )
Comparison
Runge-Kutta Third Order Method Runge-Kutta Fourth Order Method Actual values
( ) ( ) ( )
5. Heun’s Method for solving Initial value problem (IVP)is a particular case of-
(a) Runge-Kutta 4th order method
(b) Runge-Kutta 3rd order method
(c) Runge-Kutta 2nd order method
(d) None of these
6. Use Picard’s Iteration Method to find the solution up to 3th approximations to the given
initial value problem and hence obtain ( ).
, , ( ) , with
7. Use Picard’s Iteration Method to find the solution up to 4th approximations to the given
initial value problem and hence obtain ( ).
, , ( ) , with
8. Use Euler’s Method to approximate the solution to the given initial value problem at
and compare the result to the actual values.
, , ( ) , with
9. Use Euler’s Method to approximate the solution to the given initial value problem
and compare the result to the actual values.
, , ( ) , with
Note: Actual solution ( ) √( )
10.Use Modified Euler’s Method to approximate the solution to the given initial value
problem at and compare the result to the actual values.
, , ( ) , with
Note: Actual solution ( )
11.Use Taylor’s Series Method to approximate the solution to the given initial value problem
at and compare the result to the actual values.
, , ( ) , with
12. Use Taylor’s Series Method to approximate the solution to the given initial value problem
at and compare the result to the actual values.
, , ( ) , with
Note: Actual solution ( )
13.Use Huen’s Method to approximate the solution to the given initial value problem at
and compare the result to the actual values.
, , ( ) , with
14. Use Huen’s Method to approximate the solution to the given initial value problem at
and compare the result to the actual values.
, , ( ) , with
16. Use Runge-Kutta Third Order Method to approximate the solution to the given initial
value problem at and compare the result to the actual values.
, , ( ) , with
Note: Actual solution ( )
17. Use Runge-Kutta Fourth Order Method to approximate the solution to the given initial
value problem at and compare the result to the actual values.
, , ( ) , with
18. Use Runge-Kutta Fourth Order Method to approximate the solution to the given initial
value problem at and compare the result to the actual values.
, , ( ) , with
Note: Actual solution ( )