Module 2 Notes

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

Scanned with CamScanner

Scanned with CamScanner


Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Numerical Solutions of Ordinary Differential Equations
A number of numerical methods are available for the solution of first order
differential equations of the form:
𝑑𝑦
= 𝑓(𝑥, 𝑦) given 𝑦(𝑥0 ) = 𝑦0 (1)
𝑑𝑥

These methods yields solutions either as a power series in 𝑥 from which the values
of 𝑦 can be found by direct substitution, or set of values of 𝑥 and 𝑦.

The initial condition in (1) is specified at the point 𝑥0 . Such problems in which all
the conditions are given at the initial point only are called initial value problems.
But there are problems involving second and higher order differential equations in
which the conditions may be given at two or more points. These are known as
boundary value problems.

Taylor’s Series Method


𝑑𝑦
Consider the first order differential equations of the form = 𝑓(𝑥, 𝑦) with
𝑑𝑥

the initial condition 𝑦(𝑥0 ) = 𝑦0 . The solution 𝑦(𝑥) is approximated to power series
in 𝑥 − 𝑥0 using Taylor’s series. We have Taylor’s series expansion of 𝑦(𝑥) about
the point 𝑥0 in the form

(𝒙 − 𝒙𝟎 ) ′ (𝒙 − 𝒙𝟎 )𝟐 ′′ (𝒙 − 𝒙𝟎 )𝟑 ′′′ (𝒙 − 𝒙𝟎 )𝟒 ′𝒗
𝒚(𝒙) = 𝒚(𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + ⋯
𝟏! 𝟐! 𝟑! 𝟒!

1. Find by Taylor’s series method the value of 𝑦 at 𝑥 = 0.1 and 𝑥 = 0.2 to five places
𝑑𝑦
of decimals from = 𝑥 2 𝑦 − 1 with 𝑦(0) = 1.
𝑑𝑥

Solution: We have Taylor’s series expansion of 𝑦(𝑥)


(𝒙 − 𝒙𝟎 ) ′ (𝒙 − 𝒙𝟎 )𝟐 ′′ (𝒙 − 𝒙𝟎 )𝟑 ′′′ (𝒙 − 𝒙𝟎 )𝟒 ′𝒗
𝒚(𝒙) = 𝒚(𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + ⋯
𝟏! 𝟐! 𝟑! 𝟒!
Given 𝑥0 = 0, 𝑦0 = 1 𝑎𝑛𝑑 𝑦 ′ (𝑥) = 𝑥 2 𝑦 − 1
′ (0)
𝑥 2 ′′ 𝑥 3 ′′′ 𝑥 4 ′𝑣
∴ 𝑦(𝑥) = 𝑦(0) + 𝑥𝑦 + 𝑦 (0) + 𝑦 (0) + 𝑦 (0) + ⋯ (1)
2 6 24

𝒚(𝟎) = 𝟏

𝑦 ′ (𝑥) = 𝑥 2 𝑦 − 1 => 𝑦 ′ (0) = 02 (1) − 1 => 𝒚′ (𝟎) = −𝟏

𝑦 ′′ (𝑥) = 2𝑥𝑦 + 𝑥 2 𝑦 ′ => 𝑦 ′′ (0) = 2(0)(1) + 02 (−1) => 𝒚′′ (𝟎) = 𝟎

𝑦 ′′′ (𝑥) = 2𝑦 + 2𝑥𝑦 ′ + 2𝑥𝑦 ′ + 𝑥 2 𝑦 ′′ => 𝑦 ′′′ (𝑥) = 2𝑦 + 4𝑥𝑦 ′ + 𝑥 2 𝑦 ′′

=> 𝑦 ′′′ (0) = 2(1) + 4(0)(−1) + 02 (0) => 𝒚′′′ (𝟎) = 𝟐

𝑦 ′𝑣 (𝑥) = 2𝑦 ′ + 4𝑦 ′ + 4𝑥𝑦 ′′ + 2𝑥𝑦 ′′ + 𝑥 2 𝑦 ′′′ => 𝑦 ′𝑣 (𝑥) = 6𝑦 ′ + 6𝑥𝑦 ′′ + 𝑥 2 𝑦 ′′′

=> 𝑦 ′𝑣 (0) = 6(−1) + 6(0)(0) + 02 (2) => 𝒚′𝒗 (𝟎) = −𝟔

Substituting these values in (1), we get

𝑥2 𝑥3 𝑥4
𝑦(𝑥) = 1 + 𝑥(−1) + (0) + (2) + (−6) + ⋯
2 6 24

𝒙𝟑 𝒙𝟒
∴ 𝒚(𝒙) = 𝟏 − 𝒙 + − + ⋯
𝟑 𝟒
(0.1)3 (0.1)4
Hence 𝑦(0.1) = 1 − (0.1) + − => 𝒚(𝟎. 𝟏) = 𝟎. 𝟗𝟎𝟎𝟑𝟑.
3 4

(0.2)3 (0.2)4
𝑦(0.2) = 1 − (0.2) + − => 𝒚(𝟎. 𝟐) = 𝟎. 𝟖𝟎𝟐𝟐𝟕.
3 4

𝑑𝑦
2. Solve by Taylor’s series method the equation = log(𝑥𝑦) for 𝑦(1.1) and (1.2)
𝑑𝑥
correct to 5 decimal places, given 𝑦(1) = 2.
Solution: We have Taylor’s series expansion of 𝑦(𝑥)
(𝒙 − 𝒙𝟎 ) ′ (𝒙 − 𝒙𝟎 )𝟐 ′′ (𝒙 − 𝒙𝟎 )𝟑 ′′′ (𝒙 − 𝒙𝟎 )𝟒 ′𝒗
𝒚(𝒙) = 𝒚(𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + ⋯
𝟏! 𝟐! 𝟑! 𝟒!
Given 𝑥0 = 1, 𝑦0 = 2 𝑎𝑛𝑑 𝑦 ′ (𝑥) = log(𝑥𝑦) = log 𝑥 + log 𝑦

′ (1)
(𝑥 − 1)2 ′′ (𝑥 − 1)3 ′′′ (𝑥 − 1)4 ′𝑣
∴ 𝑦(𝑥) = 𝑦(1) + (𝑥−1)𝑦 + 𝑦 (1) + 𝑦 (1) + 𝑦 (1) + ⋯ (1)
2 6 24
𝒚(𝟏) = 𝟐

𝑦 ′ (𝑥) = log 𝑥 + log 𝑦 => 𝑦 ′ (1) = log 1 + log 2 => 𝒚′ (𝟏) = 𝟎. 𝟔𝟗𝟑𝟏𝟓

1 1 ′ 1 1
𝑦 ′′ (𝑥) = + 𝑦 => 𝑦 ′′ (1) = + (0.69315) => 𝒚′′ (𝟏) = 𝟏. 𝟑𝟒𝟔𝟓𝟖
𝑥 𝑦 1 2

1 1 ′ 2 1 ′′ 1 1 1
𝑦 ′′′ (𝑥) = − − (𝑦 ) + 𝑦 => 𝑦 ′′′
(1) = − − (0.69315)2
+ (1.34658)
𝑥2 𝑦2 𝑦 (1)2 (2)2 2

=> 𝒚′′′ (𝟏) = −𝟎. 𝟒𝟒𝟔𝟖𝟐

Substituting these values in (1), we get

(𝒙 − 𝟏)𝟐 (𝒙 − 𝟏)𝟑
∴ 𝒚(𝒙) = 𝟐 + (𝒙 − 𝟏)(𝟎. 𝟔𝟗𝟑𝟏𝟓) + (𝟏. 𝟑𝟒𝟔𝟓𝟖) + (−𝟎. 𝟒𝟒𝟔𝟖𝟐) + ⋯
𝟐 𝟔

Hence
(1.1 − 1)2 (1.1 − 1)3
𝑦(1.1) = 2 + (1.1 − 1)(0.69315) + (1.34658) − (0.44682)
2 6

=> 𝒚(𝟏. 𝟏) = 𝟐. 𝟎𝟕𝟓𝟗𝟕.

(1.2 − 1)2 (1.2 − 1)3


𝑦(1.2) = 2 + (1.2 − 1)(0.69315) + (1.34658) − (0.5)
2 6

=> 𝒚(𝟏. 𝟐) = 𝟐. 𝟏𝟔𝟒𝟗𝟕.

𝑑𝑦
3. Solve = 2𝑦 + 3𝑒 𝑥 , 𝑦(0) = 0 using Taylor’s series method and find y(0.1) &
𝑑𝑥

y(0.2) correct to 5 decimal places.


Solution: We have Taylor’s series expansion of 𝑦(𝑥)
(𝒙 − 𝒙𝟎 ) ′ (𝒙 − 𝒙𝟎 )𝟐 ′′ (𝒙 − 𝒙𝟎 )𝟑 ′′′ (𝒙 − 𝒙𝟎 )𝟒 ′𝒗
𝒚(𝒙) = 𝒚(𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + 𝒚 (𝒙𝟎 ) + ⋯
𝟏! 𝟐! 𝟑! 𝟒!
Given 𝑥0 = 0, 𝑦0 = 0 𝑎𝑛𝑑 𝑦 ′ (𝑥) = 2𝑦 + 3𝑒 𝑥

′ (0)
𝑥 2 ′′ 𝑥 3 ′′′ 𝑥 4 ′𝑣
∴ 𝑦(𝑥) = 𝑦(0) + 𝑥𝑦 + 𝑦 (0) + 𝑦 (0) + 𝑦 (0) + ⋯ (1)
2 6 24

𝒚 ( 𝟎) = 𝟎
𝑦 ′ (𝑥) = 2𝑦 + 3𝑒 𝑥 => 𝑦 ′ (0) = 2(0) + 3𝑒 0 => 𝒚′ (𝟎) = 𝟑

𝑦 ′′ (𝑥) = 2𝑦 ′ + 3𝑒 𝑥 => 𝑦 ′′ (0) = 2(3) + 3𝑒 0 => 𝒚′′ (𝟎) = 𝟗

𝑦 ′′′ (𝑥) = 2𝑦 ′′ + 3𝑒 𝑥 => 𝑦 ′′′ (0) = 2(9) + 3𝑒 0 => 𝒚′′′ (𝟎) = 𝟐𝟏

𝑦 ′𝑣 (𝑥) = 2𝑦 ′′′ + 3𝑒 𝑥 => 𝑦 ′′′ (0) = 2(21) + 3𝑒 0 => 𝒚′𝒗 (𝟎) = 𝟒𝟓

Substituting these values in (1), we get

𝑥2 𝑥3 𝑥4
𝑦(𝑥) = 0 + 𝑥(3) + (9) + (21) + (45) + ⋯
2 6 24

𝟗𝒙𝟐 𝟕𝒙𝟑 𝟒𝟓𝒙𝟒


∴ 𝒚(𝒙) = 𝟑𝒙 + + + +⋯
𝟐 𝟐 𝟐𝟒
9(0.1)2 7(0.1)3 45(0.1)4
Hence 𝑦(0.1) = 3(0.1) + + + => 𝒚(𝟎. 𝟏) = 𝟎. 𝟑𝟒𝟖𝟔𝟗.
2 2 24

9(0.2)2 7(0.2)3 45(0.2)4


𝑦(0.2) = 3(0.2) + + + => 𝒚(𝟎. 𝟐) = 𝟎. 𝟖𝟏𝟏𝟎𝟎.
2 2 24

1. Employ Taylor’s series method to find an approximate solution correct to fourth decimal
𝑑𝑦
places for the following initial value problem at 𝑥 = 0.1, = 𝑥−𝑦 2 , 𝑦(0) = 1.
𝑑𝑥

2. Evaluate y(0.1) correct to 6 decimal places by Taylor’s series method if y(x) satisfies
𝑑𝑦
= 𝑥𝑦 + 1, 𝑦(0) = 1.
𝑑𝑥

𝑑𝑦
3. Use Taylor’s series method to find 𝑦 at 𝑥 = 0.1, 0.2, given that = 𝑥 2 + 𝑦 2 and
𝑑𝑥

𝑦(0) = 1. (carry out computations correct to 5 decimal places)


Modified Euler’s Method
𝑑𝑦
Consider the initial value problem = 𝑓(𝑥, 𝑦); 𝑦(𝑥0 ) = 𝑦0 . We need to find 𝑦 at
𝑑𝑥

𝑥1 = 𝑥0 + ℎ. We first obtain 𝑦(𝑥1 ) = 𝑦1 by applying Euler’s formula and this value


is regarded as the first approximation and is given by 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ).

Now by modified Euler’s method, the first modified value of 𝑦1 is given by


(1) ℎ
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )].
2

The second modified value of 𝑦1 is given by

(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )].
2

The third modified value of 𝑦1 is given by

(3) ℎ (2)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] and so on.
2

1. Using Modified Euler’s method, find an approximate value of 𝑦 when 𝑥 = 0.3


𝑑𝑦
given that = 𝑥 + 𝑦 , y(0) = 1. (carry out computations correct to 5 decimal
𝑑𝑥
places)
Solution: We need to find 𝑦(0.3) by taking ℎ = 0.3.
Given 𝒙𝟎 = 𝟎, 𝒚𝟎 = 𝟏, 𝒇(𝒙, 𝒚) = 𝒙 + 𝒚. 𝑥1 = 𝑥0 + ℎ = 0 + 0.3 => 𝒙𝟏 = 𝟎. 𝟑.
From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑦1 = 1 + 0.3𝑓(0, 1) => 𝑦1 = 1 + 0.3(1) => 𝒚𝟏 = 𝟏. 𝟑
(1) ℎ
From modified Euler’s formula, 𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
(1) ℎ (1) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.3)]
2 2

(1) 0.3
𝑦1 =1+ [1 + 1.6] => 𝒚(𝟏)
𝟏 = 𝟏. 𝟑𝟗𝟎𝟎𝟎
2
(2) ℎ (1) (2) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.39)]
2 2
(2) 0.3
𝑦1 =1+ [1 + 1.69] => 𝒚(𝟐)
𝟏 = 𝟏. 𝟒𝟎𝟑𝟓𝟎
2
(3) ℎ (2) (3) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.4035)]
2 2
(3) 0.3
𝑦1 =1+ [1 + 1.7035] => 𝒚(𝟑)
𝟏 = 𝟏. 𝟒𝟎𝟓𝟓𝟑
2
(4) ℎ (3) (4) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.40553)]
2 2
(4) 0.3
𝑦1 =1+ [1 + 1.70553] => 𝒚(𝟒)
𝟏 = 𝟏. 𝟒𝟎𝟓𝟖𝟑
2
(5) ℎ (4) (5) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.40583)]
2 2
(5) 0.3
𝑦1 =1+ [1 + 1.70583] => 𝒚(𝟐)
𝟏 = 𝟏. 𝟒𝟎𝟓𝟖𝟕
2
(6) ℎ (5) (6) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.40587)]
2 2
(6) 0.3
𝑦1 =1+ [1 + 1.70587] => 𝒚(𝟔)
𝟏 = 𝟏. 𝟒𝟎𝟓𝟖𝟖
2
(7) ℎ (6) (7) 0.3
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.3, 1.40588)]
2 2
(7) 0.3
𝑦1 =1+ [1 + 1.70588] => 𝒚(𝟕)
𝟏 = 𝟏. 𝟒𝟎𝟓𝟖𝟖
2
∴ 𝑦(𝑥0 + ℎ) = 𝑦(0 + 0.3) = 𝒚(𝟎. 𝟑) = 𝟏. 𝟒𝟎𝟓𝟖𝟖

2. Using Modified Euler’s method, find y(0.2) and y(0.4) given 𝑦 ′ = 𝑦 + 𝑒 𝑥 ,


𝑦(0) = 0. (carry out computations correct to 4 decimal places)
Solution:
I Stage: We need to find 𝑦(0.2) by taking ℎ = 0.2.
Given 𝒙𝟎 = 𝟎, 𝒚𝟎 = 𝟎, 𝒇(𝒙, 𝒚) = 𝒚 + 𝒆𝒙 . 𝑥1 = 𝑥0 + ℎ = 0 + 0.2 => 𝒙𝟏 = 𝟎. 𝟐.
From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑦1 = 0 + 0.2𝑓(0, 0) => 𝑦1 = 0 + 0.2(1) => 𝒚𝟏 = 𝟎. 𝟐
From modified Euler’s formula,
(1) ℎ (1) 0.2
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] => 𝑦1 = 0 + [𝑓(0, 0) + 𝑓(0.2, 0.2)]
2 2
(1) (𝟏)
𝑦1 = 0 + (0.1)[1 + 1.4214] => 𝒚𝟏 = 𝟎. 𝟐𝟒𝟐𝟏

(2) ℎ (1) (2) 0.2


𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 0 + [𝑓(0, 0) + 𝑓(0.2, 0.2421)]
2 2
(2) (𝟐)
𝑦1 = 0 + (0.1)[1 + 1.4635] => 𝒚𝟏 = 𝟎. 𝟐𝟒𝟔𝟒

(3) ℎ (2) (3) 0.2


𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 0 + [𝑓(0, 0) + 𝑓(0.2, 0.2464)]
2 2
(3) (𝟑)
𝑦1 = 0 + (0.1)[1 + 1.4678] => 𝒚𝟏 = 𝟎. 𝟐𝟒𝟔𝟖

(4) ℎ (3) (4) 0.2


𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 0 + [𝑓(0, 0) + 𝑓(0.2, 0.2468)]
2 2
(4) (𝟒)
𝑦1 = 0 + (0.1)[1 + 1.4682] => 𝒚𝟏 = 𝟎. 𝟐𝟒𝟔𝟖
∴ 𝑦(𝑥0 + ℎ) = 𝑦(0 + 0.2) = 𝒚(𝟎. 𝟐) = 𝟎. 𝟐𝟒𝟔𝟖

II Stage: We need to find 𝑦(0.4) using 𝑦(0.2) = 0.2468 as the initial condition and
taking ℎ = 0.2. Now 𝒙𝟎 = 𝟎. 𝟐, 𝒚𝟎 = 𝟎. 𝟐𝟒𝟔𝟖, 𝒇(𝒙, 𝒚) = 𝒚 + 𝒆𝒙 .
𝑥1 = 𝑥0 + ℎ = 0.2 + 0.2 => 𝒙𝟏 = 𝟎. 𝟒.
From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑦1 = 0.2468 + 0.2𝑓(0.2, 0.2468) => 𝑦1 = 0.2468 + 0.2(1.4682) => 𝒚𝟏 = 𝟎. 𝟓𝟒𝟎𝟒
From modified Euler’s formula,

(1) ℎ
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
(1) 0.2
=> 𝑦1 = 0.2468 + [𝑓(0.2, 0.2468) + 𝑓(0.4, 0.5404)]
2
(1) (𝟏)
=> 𝑦1 = 0.2468 + (0.1)[1.4682 + 2.0322] => 𝒚𝟏 = 𝟎. 𝟓𝟗𝟔𝟖

(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(2) 0.2
=> 𝑦1 = 0.2468 + [𝑓(0.2, 0.2468) + 𝑓(0.4, 0.5968)]
2
(2) (𝟐)
=> 𝑦1 = 0.2468 + (0.1)[1.4682 + 2.0886] => 𝒚𝟏 = 𝟎. 𝟔𝟎𝟐𝟓
(3) ℎ (2)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(3) 0.2
=> 𝑦1 = 0.2468 + [𝑓(0.2, 0.2468) + 𝑓(0.4, 0.6025)]
2
(3) (𝟑)
=> 𝑦1 = 0.2468 + (0.1)[1.4682 + 2.0943] => 𝒚𝟏 = 𝟎. 𝟔𝟎𝟑𝟏

(4) ℎ (3)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(4) 0.2
=> 𝑦1 = 0.2468 + [𝑓(0.2, 0.2468) + 𝑓(0.4, 0.6031)]
2
(4) (𝟒)
=> 𝑦1 = 0.2468 + (0.1)[1.4682 + 2.0949] => 𝒚𝟏 = 𝟎. 𝟔𝟎𝟑𝟏

∴ 𝑦(𝑥0 + ℎ) = 𝑦(0.2 + 0.2) = 𝒚(𝟎. 𝟒) = 𝟎. 𝟔𝟎𝟑𝟏

𝑑𝑦
3. Use Modified Euler’s method to solve = 𝑥 + │√𝑦│ , y (0) = 1, for the range
𝑑𝑥
0 < 𝑥 < 0.6 taking h = 0.2. (Carry out computations correct to 3 decimal places)
Solution:
I Stage: We need to find 𝑦(0.2) by taking ℎ = 0.2.

Given 𝒙𝟎 = 𝟎, 𝒚𝟎 = 𝟏, 𝒇(𝒙, 𝒚) = 𝒙 + √𝒚. 𝑥1 = 𝑥0 + ℎ = 0 + 0.2 => 𝒙𝟏 = 𝟎. 𝟐.

From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )


𝑦1 = 1 + 0.2𝑓(0, 1) => 𝑦1 = 1 + 0.2(1) => 𝒚𝟏 = 𝟏. 𝟐
From modified Euler’s formula,
(1) ℎ (1) 0.2
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.2, 1.2)]
2 2
(1) (𝟏)
𝑦1 = 1 + (0.1)[1 + 1.295] => 𝒚𝟏 = 𝟏. 𝟐𝟑𝟎

(2) ℎ (1) (2) 0.2


𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.2, 1.230)]
2 2
(2) (𝟐)
𝑦1 = 1 + (0.1)[1 + 1.309] => 𝒚𝟏 = 𝟏. 𝟐𝟑𝟏

(3) ℎ (2) (3) 0.2


𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )] => 𝑦1 = 1 + [𝑓(0, 1) + 𝑓(0.2, 1.231)]
2 2
(3) (𝟑)
𝑦1 = 1 + (0.1)[1 + 1.310] => 𝒚𝟏 = 𝟏. 𝟐𝟑𝟏
∴ 𝑦(𝑥0 + ℎ) = 𝑦(0 + 0.2) = 𝒚(𝟎. 𝟐) = 𝟏. 𝟐𝟑𝟏
II Stage: We need to find 𝑦(0.4) using 𝑦(0.2) = 1.231 as the initial condition and
taking ℎ = 0.2. Now 𝒙𝟎 = 𝟎. 𝟐, 𝒚𝟎 = 𝟏. 𝟐𝟑𝟏, 𝒇(𝒙, 𝒚) = 𝒙 + √𝒚.

𝑥1 = 𝑥0 + ℎ = 0.2 + 0.2 => 𝒙𝟏 = 𝟎. 𝟒.


From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑦1 = 1.231 + 0.2𝑓(0.2, 1.231) => 𝑦1 = 1.231 + 0.2(1.310) => 𝒚𝟏 = 𝟏. 𝟒𝟗𝟑
From modified Euler’s formula,

(1) ℎ
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
(1) 0.2
=> 𝑦1 = 1.231 + [𝑓(0.2, 1.231) + 𝑓(0.4, 1.493)]
2
(1) (𝟏)
=> 𝑦1 = 1.231 + (0.1)[1.310 + 1.622] => 𝒚𝟏 = 𝟏. 𝟓𝟐𝟒

(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(2) 0.2
=> 𝑦1 = 1.231 + [𝑓(0.2, 1.231) + 𝑓(0.4, 1.524)]
2
(1) (𝟏)
=> 𝑦1 = 1.231 + (0.1)[1.310 + 1.635] => 𝒚𝟏 = 𝟏. 𝟓𝟐𝟓

(3) ℎ (2)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(3) 0.2
=> 𝑦1 = 1.231 + [𝑓(0.2, 1.231) + 𝑓(0.4, 1.525)]
2
(3) (𝟏)
=> 𝑦1 = 1.231 + (0.1)[1.310 + 1.635] => 𝒚𝟏 = 𝟏. 𝟓𝟐𝟓
∴ 𝑦(𝑥0 + ℎ) = 𝑦(0.2 + 0.2) = 𝒚(𝟎. 𝟒) = 𝟏. 𝟓𝟐𝟓

III Stage: We need to find 𝑦(0.6) using 𝑦(0.4) = 1.525 as the initial condition and
taking ℎ = 0.2. Now 𝒙𝟎 = 𝟎. 𝟒, 𝒚𝟎 = 𝟏. 𝟓𝟐𝟓, 𝒇(𝒙, 𝒚) = 𝒙 + √𝒚.

𝑥1 = 𝑥0 + ℎ = 0.4 + 0.2 => 𝒙𝟏 = 𝟎. 𝟔.


From Euler’s formula, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑦1 = 1.525 + 0.2𝑓(0.4, 1.525) => 𝑦1 = 1.525 + 0.2(1.635) => 𝒚𝟏 = 𝟏. 𝟖𝟓𝟐
From modified Euler’s formula,
(1) ℎ
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
(1) 0.2
=> 𝑦1 = 1.525 + [𝑓(0.4, 1.525) + 𝑓(0.6, 1.852)]
2
(1) (𝟏)
=> 𝑦1 = 1.525 + (0.1)[1.635 + 1.961] => 𝒚𝟏 = 𝟏. 𝟖𝟖𝟓

(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(2) 0.2
=> 𝑦1 = 1.525 + [𝑓(0.4, 1.525) + 𝑓(0.6, 1.885)]
2
(2) (𝟐)
=> 𝑦1 = 1.525 + (0.1)[1.635 + 1.973] => 𝒚𝟏 = 𝟏. 𝟖𝟖𝟔

(3) ℎ (2)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )]
2
(3) 0.2
=> 𝑦1 = 1.525 + [𝑓(0.4, 1.525) + 𝑓(0.6, 1.886)]
2
(3) (𝟑)
=> 𝑦1 = 1.525 + (0.1)[1.635 + 1.973] => 𝒚𝟏 = 𝟏. 𝟖𝟖𝟔
∴ 𝑦(𝑥0 + ℎ) = 𝑦(0.4 + 0.2) = 𝒚(𝟎. 𝟔) = 𝟏. 𝟖𝟖𝟔

𝑦
1. Using modified Euler’s method find 𝑦 𝑎𝑡 𝑥 = 0.2, given 𝑦 ′ = 3𝑥 + 𝑤𝑖𝑡ℎ 𝑦(0) = 1,
2

ℎ = 0.1. (carry out computations correct to 4 decimal places)

𝑑𝑦
2. Using Modified Euler’s method to find y (0.1) given = 𝑥 2 + 𝑦 , 𝑦(0) = 1 by taking
𝑑𝑥

h =0.05. (carry out computations correct to 4 decimal places)

𝑑𝑦 1
3. Given = − 2𝑦 2 , 𝑦(0) = 0 Find 𝑦(0.5) in two steps, using the Modified
𝑑𝑥 1+𝑥 2

Euler’s method. (carry out computations correct to 4 decimal places)


Runge Kutta Method of fourth order
The fourth order Runge Kutta method is often referred to as Runge Kutta method
only. This method is used for finding the increment 𝑘 of 𝑦 corresponding to an
𝑑𝑦
increment ℎ of 𝑥 from the initial value problem = 𝑓(𝑥, 𝑦); 𝑦(𝑥0 ) = 𝑦0 .
𝑑𝑥

The method is as follows:

Calculate successively
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 )

ℎ 𝑘1
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + )
2 2
ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) 𝑎𝑛𝑑
2 2

𝑘4 = ℎ𝑓 (𝑥0 + ℎ, 𝑦0 + 𝑘3 ).
1
Finally compute 𝑘 = (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) which gives the required
6

approximate value 𝒚𝟏 = 𝒚𝟎 + 𝒌.

𝑑𝑦
1. Apply Runge-Kutta method of fourth order to solve = 𝑥 + 𝑦, 𝑦(0) = 1 at
𝑑𝑥
𝑥 = 0.2 with step length h = 0.2. (carry out computations correct to 4 decimal
places)
Solution: Here 𝑥0 = 0, 𝑦0 = 1, 𝒇(𝒙, 𝒚) = 𝒙 + 𝒚 and ℎ = 0.2.
From Runge Kutta method,
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.2𝑓(0, 1) = 0.2(1) => 𝒌𝟏 = 𝟎. 𝟐
ℎ 𝑘1 0.2 0.2
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0 + ,1 + ) = 0.2𝑓(0.1, 1.1)
2 2 2 2
=> 𝑘2 = 0.2(1.2) => 𝒌𝟐 = 𝟎. 𝟐𝟒
ℎ 𝑘2 0.2 0.24
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0 + ,1+ ) = 0.2𝑓(0.1, 1.12)
2 2 2 2
=> 𝑘3 = 0.2(1.22) => 𝒌𝟑 = 𝟎. 𝟐𝟒𝟒
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.2𝑓(0 + 0.2, 1 + 0.244) = 0.2𝑓(0.2, 1.244)
=> 𝑘4 = 0.2(1.444) => 𝒌𝟒 = 𝟎. 𝟐𝟖𝟖𝟖
1 1
∴ 𝑘 = (𝑘1 + 2𝑘2 + 3𝑘3 + 𝑘4 ) = (0.2 + 2(0.24) + 2(0.244) + 0.2888)
6 6
=> 𝒌 = 𝟎. 𝟐𝟒𝟐𝟖
Hence the required approximate value of 𝑦 is
𝑦1 = 𝑦(𝑥0 + ℎ) = 𝑦0 + 𝑘 => 𝑦(0 + 0.2) = 1 + 0.2428
∴ 𝒚(𝟎. 𝟐) = 𝟏. 𝟐𝟒𝟐𝟖

𝑑𝑦 𝑦 2 −𝑥 2
2. Using Runge- Kutta 4th order method to solve = with 𝑦(0) = 1 at
𝑑𝑥 𝑦 2 +𝑥 2
𝑥 = 0.2, 0.4. (carry out computations correct to 5 decimal places)
I Stage: First we need to find 𝑦(0.2).
𝒚𝟐 −𝒙𝟐
Here 𝑥0 = 0, 𝑦0 = 1, 𝒇(𝒙, 𝒚) = and ℎ = 0.2.
𝒚𝟐 +𝒙𝟐

From Runge Kutta method,


𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.2𝑓(0, 1) = 0.2(1) => 𝒌𝟏 = 𝟎. 𝟐
ℎ 𝑘1 0.2 0.2
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0 + ,1 + ) = 0.2𝑓(0.1, 1.1)
2 2 2 2
=> 𝑘2 = 0.2(0.98361) => 𝒌𝟐 = 𝟎. 𝟏𝟗𝟔𝟕𝟐
ℎ 𝑘2 0.2 0.19672
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0 + ,1+ ) = 0.2𝑓(0.1, 1.09836)
2 2 2 2
=> 𝑘3 = 0.2(0.98356) => 𝒌𝟑 = 𝟎. 𝟏𝟗𝟔𝟕𝟏
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.2𝑓(0 + 0.2, 1 + 0.19671) = 0.2𝑓(0.2, 1.19671)
=> 𝑘4 = 0.2(0.94566) => 𝒌𝟒 = 𝟎. 𝟏𝟖𝟗𝟏𝟑
1 1
∴ 𝑘 = (𝑘1 + 2𝑘2 + 3𝑘3 + 𝑘4 ) = (0.2 + 2(0.19672) + 2(0.19671) + 0.18913)
6 6
=> 𝒌 = 𝟎. 𝟏𝟗𝟔𝟎𝟎
Hence the required approximate value of 𝑦 is
𝑦1 = 𝑦(𝑥0 + ℎ) = 𝑦0 + 𝑘 => 𝑦(0 + 0.2) = 1 + 0.196
∴ 𝒚(𝟎. 𝟐) = 𝟏. 𝟏𝟗𝟔

II Stage: We need to find 𝑦(0.4) using 𝑦(0.2) = 1.196 as the initial condition.
𝒚𝟐 −𝒙𝟐
Here 𝑥0 = 0.2, 𝑦0 = 1.196, 𝒇(𝒙, 𝒚) = and ℎ = 0.2.
𝒚𝟐 +𝒙𝟐

From Runge Kutta method,


𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.2𝑓(0.2, 1.196) = 0.2(0.94559) => 𝒌𝟏 = 𝟎. 𝟏𝟖𝟗𝟏𝟐
ℎ 𝑘1 0.2 0.18912
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0.2 + , 1.196 + ) = 0.2𝑓(0.3, 1.29056)
2 2 2 2
=> 𝑘2 = 0.2(0.89747) => 𝒌𝟐 = 𝟎. 𝟏𝟕𝟗𝟒𝟗
ℎ 𝑘2 0.2 0.17949
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.2𝑓 (0.2 + , 1.196 + ) = 0.2𝑓(0.3, 1.28575)
2 2 2 2
=> 𝑘3 = 0.2(0.89674) => 𝒌𝟑 = 𝟎. 𝟏𝟕𝟗𝟑𝟓
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.2𝑓(0.2 + 0.2, 1.196 + 0.17935) = 0.2𝑓(0.4, 1.37535)
=> 𝑘4 = 0.2(0.84402) => 𝒌𝟒 = 𝟎. 𝟏𝟔𝟖𝟖𝟎
1 1
∴ 𝑘 = (𝑘1 + 2𝑘2 + 3𝑘3 + 𝑘4 ) = (0.18912 + 2(0.17949) + 2(0.17935) + 0.1688)
6 6
=> 𝒌 = 𝟎. 𝟏𝟕𝟗𝟐𝟕
Hence the required approximate value of 𝑦 is
𝑦1 = 𝑦(𝑥0 + ℎ) = 𝑦0 + 𝑘 => 𝑦(0.2 + 0.2) = 1.196 + 0.17927
∴ 𝒚(𝟎. 𝟒) = 𝟏. 𝟑𝟕𝟓𝟐𝟓

𝑑𝑦 𝑦
3. Using Runge-Kutta method of order 4, Solve = 3𝑥 + , 𝑦(0) = 1 at the points
𝑑𝑥 2

𝑥 = 0.1, 0.2 by taking step length take h = 0.1. (carry out computations correct to
4 decimal places)

I Stage: First we need to find 𝑦(0.1).


Here 𝑥0 = 0, 𝑦0 = 1, 𝒇(𝒙, 𝒚) = 𝟑𝒙 + 𝒚/𝟐 and ℎ = 0.1.
From Runge Kutta method,
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.1𝑓(0, 1) = 0.1(0.5) => 𝒌𝟏 = 𝟎. 𝟎𝟓
ℎ 𝑘1 0.1 0.05
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.1𝑓 (0 + ,1 + ) = 0.1𝑓(0.05, 1.025)
2 2 2 2
=> 𝑘2 = 0.1(0.6625) => 𝒌𝟐 = 𝟎. 𝟎𝟔𝟔𝟑
ℎ 𝑘2 0.1 0.0663
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.1𝑓 (0 + ,1+ ) = 0.1𝑓(0.05, 1.0331)
2 2 2 2
=> 𝑘3 = 0.1(0.6666) => 𝒌𝟑 = 𝟎. 𝟎𝟔𝟕𝟕
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.1𝑓(0 + 0.1, 1 + 0.0677) = 0.1𝑓(0.1, 1.0677)
=> 𝑘4 = 0.1(0.8339) => 𝒌𝟒 = 𝟎. 𝟎𝟖𝟑𝟒
1 1
∴ 𝑘 = (𝑘1 + 2𝑘2 + 3𝑘3 + 𝑘4 ) = (0.05 + 2(0.0663) + 2(0.0677) + 0.0834)
6 6
=> 𝒌 = 𝟎. 𝟎𝟔𝟔𝟗
Hence the required approximate value of 𝑦 is
𝑦1 = 𝑦(𝑥0 + ℎ) = 𝑦0 + 𝑘 => 𝑦(0 + 0.1) = 1 + 0.0669
∴ 𝒚(𝟎. 𝟏) = 𝟏. 𝟎𝟔𝟔𝟗

II Stage: We need to find 𝑦(0.2) using 𝑦(0.1) = 1.0669 as the initial condition.
Here 𝑥0 = 0.1, 𝑦0 = 1.0669, 𝒇(𝒙, 𝒚) = 𝟑𝒙 + 𝒚/𝟐 and ℎ = 0.1.
From Runge Kutta method,
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.1𝑓(0.1, 1.0699) = 0.1(0.8335) => 𝒌𝟏 = 𝟎. 𝟎𝟖𝟑𝟑
ℎ 𝑘1 0.1 0.0833
𝑘2 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.1𝑓 (0.1 + , 1.0669 + ) = 0.1𝑓(0.15, 1.1086)
2 2 2 2
=> 𝑘2 = 0.1(1.0043) => 𝒌𝟐 = 𝟎. 𝟏𝟎𝟎𝟒
ℎ 𝑘2 0.1 0.1004
𝑘3 = ℎ𝑓 (𝑥0 + , 𝑦0 + ) = 0.1𝑓 (0.1 + , 1.0669 + ) = 0.1𝑓(0.15, 1.1171)
2 2 2 2
=> 𝑘3 = 0.1(1.0086) => 𝒌𝟑 = 𝟎. 𝟏𝟎𝟎𝟗
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.1𝑓(0.1 + 0.1, 1.0669 + 0.1009) = 0.1𝑓(0.2, 1.1678)
=> 𝑘4 = 0.1(1.1839) => 𝒌𝟒 = 𝟎. 𝟏𝟏𝟖𝟒
1 1
∴ 𝑘 = (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) = (0.0835 + 2(0.1004) + 2(0.1009) + 0.1184)
6 6
=> 𝒌 = 𝟎. 𝟏𝟎𝟎𝟕
Hence the required approximate value of 𝑦 is
𝑦1 = 𝑦(𝑥0 + ℎ) = 𝑦0 + 𝑘 => 𝑦(0.1 + 0.1) = 1.0669 + 0.1008
∴ 𝒚(𝟎. 𝟐) = 𝟏. 𝟏𝟔𝟕𝟔

𝑑𝑦
1. Apply Runge-Kutta method of order 4, to compute 𝑦(0.2) given 10 = 𝑥 2 + 𝑦2,
𝑑𝑥

𝑦(0) = 1 taking h = 0.1. (carry out computations correct to 4 decimal places)

𝑑𝑦
2. Use Runge-Kutta method of 4th order for 𝑦(0.1), 𝑦(0.2) given that = 𝑦(𝑥 + 𝑦),
𝑑𝑥

𝑦(0) = 1. (carry out computations correct to 4 decimal places)

𝑑𝑦 𝑦−𝑥
3. Using Runge-Kutta method of order 4, find y(0.2) for the equation = ,
𝑑𝑥 𝑦+𝑥

𝑦(0) = 1 taking h =0.1. (carry out computations correct to 4 decimal places)

You might also like