BMATE201 - Module 5
BMATE201 - Module 5
Working rule:
𝑑𝑦
❖ Consider the initial value problem 𝑑𝑥 = 𝑓(𝑥, 𝑦)with 𝑦(𝑥0 ) = 𝑦0.
𝑦 ′′ = 2𝑥𝑦 + 𝑥 2 𝑦 ′ 𝑦 ′′ (0) = 0
2. Employ Taylor’s series method to obtain approx. value of 𝐲 at 𝐱 = 𝟎. 𝟐 for the differential
𝐝𝐲
equation = 𝟐𝐲 + 𝟑𝐞𝐱 , 𝐲(𝟎) = 𝟎. Compare the numerical solution obtained with exact
𝐝𝐱
solution. ( Jan 2018)
By data, 𝑥0 = 0, 𝑦0 = 0 𝑦 ′ = 2𝑦 + 3𝑒 𝑥 𝑦 ′ (0)
=3
𝑦 ′′ = 2𝑦 ′ + 3𝑒 𝑥 𝑦 ′′ (0) = 9
By Taylor’s series:
𝑥 − 𝑥0 ′ (𝑥 − 𝑥0 )2 ′′ (𝑥 − 𝑥0 )3 ′′′
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (0) + ⋯
1! 2! 3!
Put 𝑥0 = 1, 𝑦(1) = 2, 𝑦 ′ (1) = 0.6932, 𝑦′′ (1) = 1.3466, 𝑦′′′ (1) = 0.4667.
𝑥 − 𝑥0 (𝑥 − 𝑥0 )2 (𝑥 − 𝑥0 )3
𝑦(𝑥) = 2 + (0.6932) + (1.3466) + (0.4667) + ⋯
1! 2! 3!
Therefore, 𝑦(𝑥) = 2 + (𝑥 − 1)0.6931 + (𝑥 − 1)2 0.6733 + (𝑥 − 1)3 (0.4667)
𝑦(1.1) = 2.0807, 𝑦(1.2) = 2.1692.
𝐝𝐲
4. Find an approx. value of 𝐲 when 𝐱 = 𝟎. 𝟏 if 𝐝𝐱 = 𝐱 − 𝐲 𝟐 and 𝐲 = 𝟏 at 𝐱 = 𝟎 using Taylor’s
series method.
By data, 𝑥0 = 0, 𝑦0 = 1
𝑦 ′ = 𝑥 − 𝑦2 𝑦 ′ (0) = −1
𝑦 ′′ = 1 − 2𝑦𝑦′ 𝑦 ′′ (0) = 3
𝑦 ′′′ (0) = −8
𝑦 ′′′ = −2𝑦𝑦′′ − 2𝑦′2
𝑦 𝑖𝑣 (0) = 34
𝑦 𝑖𝑣 = −2𝑦𝑦 ′′′ − 2𝑦 ′′ 𝑦 ′ − 4𝑦′𝑦′′
Taylor’s series:
𝑥 − 𝑥0 ′ (𝑥 − 𝑥0 )2 ′′ (𝑥 − 𝑥0 )3 ′′′
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (0) + ⋯
1! 2! 3!
Put 𝑥0 = 0, 𝑦(0) = 1, 𝑦 ′ (0) = −1, 𝑦′′ (0) = 3, 𝑦′′′ (0) = −8.
𝑥 𝑥2 𝑥3 𝑥4
𝑦(𝑥) = 1 + (−1) + (3) + (−8) + (34) + ⋯
1! 2! 3! 4!
3𝑥 2 4 3 17 4
𝑦(𝑥) = 1 − 𝑥 + − 𝑥 + 𝑥
2 3 6
𝑦(0.1) = 0.9139
By data, 𝑥0 = 1, 𝑦0 = 0 𝑦′ = 𝑥 + 𝑦 𝑦 ′ (1) = 1
𝑦′′ = 1 + 𝑦′ 𝑦 ′′ (1) = 2
𝑦 ′′′ = 𝑦 ′′ 𝑦 ′′′ (1) = 2
𝑦 𝑖𝑣 = 𝑦′′′ 𝑦 𝑖𝑣 (1) = 2
By Taylor’s series,
𝑥 − 𝑥0 ′ (𝑥 − 𝑥0 )2 ′′ (𝑥 − 𝑥0 )3 ′′′
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (0) + ⋯
1! 2! 3!
Put 𝑥0 = 1, 𝑦(1) = 0, 𝑦 ′ (1) = 1, 𝑦′′ (1) = 2, 𝑦′′′ (1) = 2, 𝑦 𝑖𝑣 (1) = 2
6. Evaluate 𝐲(𝟎. 𝟏) correct to 6 places of decimal by Taylor’s series method if 𝐲(𝐱) satisfies
𝒚′ = 𝒙𝒚 + 𝟏, 𝒚(𝟎) = 𝟏.
By data, 𝑥0 = 0, 𝑦0 = 1,
𝑦 ′ = 𝑥𝑦 + 1 𝑦 ′ (0) = 1
By Taylor’s series,
𝑥 − 𝑥0 ′ (𝑥 − 𝑥0 )2 ′′ (𝑥 − 𝑥0 )3 ′′′
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (0) + ⋯
1! 2! 3!
Put 𝑥0 = 0, 𝑦(0) = 1, 𝑦 ′ (0) = 1, 𝑦′′ (0) = 1, 𝑦′′′ (0) = 2
𝑥 𝑥2 𝑥3
𝑦(𝑥) = 1 + (1) + (1) + (2) + ⋯
1! 2! 3!
𝑥2 𝑥3
𝑦(𝑥) = 1 + 𝑥 + + , 𝑦(0.1) = 1.1053.
2 3
By data, 𝑥0 = 0, 𝑦0 = 1
𝑦 ′ = 3𝑥 + 𝑦2 𝑦 ′ (0) = 1
2 𝑦 ′′′ (0) = 12
𝑦 ′′′ = 2𝑦𝑦 ′′ + 2𝑦 ′
By Taylor’s series,
𝑥 − 𝑥0 ′ (𝑥 − 𝑥0 )2 ′′ (𝑥 − 𝑥0 )3 ′′′
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (𝑥0 ) + 𝑦 (0) + ⋯
1! 2! 3!
5𝑥 2
𝑦(𝑥) = 1 + 𝑥 + + 2𝑥 3
2
𝑦(0.1) = 1.1272.
𝒅𝒚
8. Using Taylor’s series method find 𝐲(𝟎. 𝟏) to 3 decimal places given that = 𝒆𝒙 − 𝒚 𝟐 ,
𝒅𝒙
𝒚(𝟎) = 𝟏
By data, 𝑥0 = 0, 𝑦0 = 1, 𝑦 ′ = 𝑒𝑥 − 𝑦2 𝑦 ′ (0) = 0
𝑥2 𝑥3
𝑦(𝑥) = 1 + − , 𝑦(0.1) = 1.0048.
2 6
𝑑𝑦
❖ Consider the initial value problem 𝑑𝑥 = 𝑓(𝑥, 𝑦) with 𝑦(𝑥0 ) = 𝑦0.
𝑑𝑦
Note 1: 𝑦1 = 𝑦0 + 𝑝 = 𝑦0 + ℎ tan 𝜃 = 𝑦0 + ℎ [ ] = 𝑦0 + ℎ 𝑓(𝑥0 , 𝑦0 )
𝑑𝑥 (𝑥0 ,𝑦0 )
(Accuracy can be improved by using Modified Euler’s method. By default, carryout two
modifications.)
𝑦1 = 𝑦(0.1) = 1.1105
𝑦1 = 𝑦(0.1) = 1.0514
𝑦1 = 𝑦(0.2) = 0.2464
= 2.0995
(2) ℎ (1)
𝑦1 = 𝑦0 + 2 [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
0.2
=2+ [𝑓(1, 2) + 𝑓(0.2, 2.0995)]
2
𝑦1 = 𝑦(1.2) = 2.0995
𝑦1 = 𝑦(1.2) = 2.1988
Solution:
By data, 𝑓(𝑥, 𝑦) = 𝑥 + |√𝑦|, ℎ = 0.2
Step 1: Find 𝒚𝟏 𝑥0 = 0 𝑥1 = 0.2
By Euler’s formula, 𝑦0 = 1 𝑦1 =?
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
= 1 + 0.2𝑓(0, 1) = 1 + 0.2(1) = 1.2
By Modified Euler’s formula,
(1) ℎ
𝑦1 = 𝑦0 + 2 [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
0.2
=1+ [1 + 𝑓(0.2, 1.2)]
2
𝑦1 = 𝑦(0.2) = 1.2309
𝑦−𝑥
By data, 𝑓(𝑥, 𝑦) = 𝑦+𝑥 ℎ = 0.1
𝑦1 = 𝑦(0.1) = 1.0916
10. Using modified Euler’s formula, compute y(1.1)correct to five decimal places given that
dy y 1
+ x = x2 and y = 1 at x = 1. [Taking h = 0.1] [Aug
dx
21]
y
11. Solve y ′ (x) = 3x + 2 , y(0) = 1 then find y(0.2) with h = 0.2 using modified Euler’s
method. [Sep 20]]
dy
12. Given = x + sin y, y(0) = 1. Compute y(0.4) with h = 0.2 using Euler’s modified
dx
method. [Jan 20]
dy
13. Using modified Euler’s method to compute y(0.2), given − xy 2 = 0 under the initial
dx
condition y(0) = 2. Perform three iteration at each step, taking h = 0.1.
[MQP 1, 18MAT]
dy
14. Solve the differential equation = x√y under the initial condition y(1) = 1, by using
dx
modified Euler’s method at the point x = 1.4. Perform three iterations at each step, taking
h=0.2. [MQP 2, 18MAT]
Working Rule:
𝑑𝑦
❖ Consider the initial value problem 𝑑𝑥 = 𝑓(𝑥, 𝑦) with 𝑦(𝑥0 ) = 𝑦0.
1
❖ 𝑦1 = 𝑦0 + 𝑘 = 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
Where
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 )
ℎ 𝑘1
𝑘2 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + )
2
ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + )
2
𝑘4 = ℎ𝑓(𝑥0 + ℎ , 𝑦0 + 𝑘3 )
1. Apply Runge - Kutta method of fourth order to find an approximate value of 𝐲 when 𝐱 =
𝐝𝐲
𝟎. 𝟐 given that 𝐝𝐱 = 𝐱 + 𝐲 and 𝐲 = 𝟏 when 𝐱 = 𝟎 .
= 0.2𝑓(0.1, 1.12)
= 0.2(0.1 + 1.12) = 0.244
𝑘4 = ℎ𝑓(𝑥0 + ℎ , 𝑦0 + 𝑘3 )
= 0.2𝑓(0.2, 1.244)
= 0.2(0.2 + 1.244) = 0.2888
𝑦1 = 𝑦0 + 𝑘
1
= 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
1
= 1 + 6 (0.2 + 0.48 + 0.488 + 0.2888)
= 1.2428
Conclusion: 𝑦1 = 𝑦(0.2) = 1.2428
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) 𝑥0 = 0 𝑥1 = 0.2
𝑦0 = 1 𝑦1 =?
= 0.2(1) = 0.2
ℎ 𝑘1
𝑘2 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + )
2
ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + )
2
= 0.2𝑓(0.1, 1.0984)
1.09842 −0.12
= 0.2 (1.09842+0.12) = 0.1967
𝑘4 = ℎ𝑓(𝑥0 + ℎ , 𝑦0 + 𝑘3 )
= 0.2𝑓(0.2, 1.1967)
1.19672 −0.22
= 0.2 (1.19672+0.22) = 0.1891
𝑦1 = 𝑦0 + 𝑘
1
= 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
1
= 1 + 6 (0.2 + 0.3934 + 0.3934 + 0.1891)
= 1.1960
Conclusion: 𝑦1 = 𝑦(0.2) = 1.1960
= 1.1164
Conclusion: 𝑦1 = 𝑦(0.1) = 1.1164
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) 𝑥0 = 0 𝑥1 = 0.1
𝑦0 = 1 𝑦1 =?
= 0.1(0.5) = 0.05
ℎ 𝑘1
𝑘2 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + )
2
= 1.0666
Conclusion: 𝑦1 = 𝑦(0.1) = 1.0666
𝑘4 = ℎ𝑓(𝑥0 + ℎ , 𝑦0 + 𝑘3 )
= 0.1 𝑓(0.1, 0.3499)
= 0.1 (𝑒 0.1 + 2(0.3499)) = 0.4015
𝑦1 = 𝑦0 + 𝑘
1
= 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
1
= 1 + 6 {0.3 + 2(0.3454) + 2(0.3499) + 0.4015}
= 1.3487
Conclusion: 𝑦1 = 𝑦(0.1) = 1.3487
𝑘4 = ℎ𝑓(𝑥0 + ℎ , 𝑦0 + 𝑘3 )
= 0.1 𝑓(0.2, 1.1678 )
1.1678−0.2
= 0.1 ( ) = 0.0708
1.1678+0.2
𝑦1 = 𝑦0 + 𝑘
1
= 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
1
= 1.0912 + 6 {0,0832 + 2(0.0766) + 2(0.0766) + 0.0708}
= 1.1679
Conclusion: 𝑦1 = 𝑦(0.2) = 1.1679
Home work:
7. Using Runge-Kutta method of fourth order find y(1.1) given that 𝑦 = 1.2 when 𝑥 = 1 and
dy
= 3x + y 2 .
dx
𝑑𝑦
8. Using Runge-Kutta method of fourth order find y(1.2) from = 𝑥 2 + 𝑦 2 , 𝑦(0) = 1 taking
𝑑𝑥
ℎ = 0.1
Working Rule:
𝑑𝑦
❖ Consider the ordinary differential equation 𝑑𝑥 = 𝑓(𝑥, 𝑦) with
By data, 𝑥 𝑦 𝑓 = 𝑥𝑦 + 𝑦 2
𝑥0 = 0 𝑦0 = 1 𝑓0 = 1
𝑥1 = 0.1 𝑦1 = 1.1169 𝑓1 = 1.3591
𝑥2 = 0.2 𝑦2 = 1.2773 𝑓2 = 1.8869
𝑥3 = 0.3 𝑦3 = 1.5049 𝑓3 = 2.7162
= 1.8352
𝑓4 = 𝑥4 𝑦4 + 𝑦4 2
= (0.4)(1.8352) + 1.83522
= 4.1020
By Milne’s corrector formula,
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 )
0.1
= 1.2773 + (1.8869 + 4(2.7162) + 4.1020)
3
= 1.8391
𝑓4 = 𝑥4 𝑦4 + 𝑦4 2
= (0.4)(1.8352) + 1.83522
= 4.1179
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 )
0.1
= 1.2773 + (1.8869 + 4(2.7162) + 4.1179)
3
= 1.8397
Conclusion: 𝒚𝟒 = 𝒚(𝟎. 𝟒) = 𝟏. 𝟖𝟑𝟗𝟕
By data,
𝑥 𝑦 𝑦
𝑓 = 𝑥2 +
2
𝑥0 = 1 𝑦0 = 2 𝑓0 = 2
𝑥1 = 1.1 𝑦1 = 2.2156 𝑓1 = 2.3178
𝑥2 = 1.2 𝑦2 = 2.4549 𝑓2 = 2.6675
𝑥3 = 1.3 𝑦3 = 2.7514 𝑓3 = 3.0657
= 3.0799
𝑦4
𝑓4 = 𝑥42 + 2
3.0799
= 1.42 + 2
= 3.5
By Milne’s corrector formula,
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 )
0.1
= 2.4549 + (2.6675 + 4(3.0657) + 3.5)
3
= 3.0692
𝑦4
𝑓4 = 𝑥42 + 2
3.0692
= 1.42 + 2
= 3.4946
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 )
0.1
= 2.4549 + (2.6675 + 4(3.0657) + 3.4946)
3
= 3.0690
Conclusion: 𝒚𝟒 = 𝒚(𝟏. 𝟒) = 𝟑. 𝟎𝟔𝟗𝟎
= 2.1623
𝑓4 = 2𝑒 𝑥4 − 𝑦4
= 2𝑒 0.4 − 2.1623
= 0.8213
By Milne’s corrector formula,
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 )
0.1
= 2.04 + (0.4028 + 4(0.6097) + 0.8213)
3
= 2.1621
𝑓4 = 2𝑒 𝑥4 − 𝑦4
= 2𝑒 0.4 − 2.1621
= 0.8215
(𝑐) ℎ
𝑦4 = 𝑦2 + (𝑓2 + 4𝑓3 + 𝑓4 )
3
0.1
= 2.04 + (0.4028 + 4(0.6097) + 0.8213)
3
= 2.1621
Conclusion: 𝒚𝟒 = 𝒚(𝟎. 𝟒) = 𝟐. 𝟏𝟔𝟐𝟏
𝑓4 = 𝑥4 − 𝑦4 2 = 0.9513
By Milne’s corrector formula,
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 ) = 1.2798
𝑓4 = 𝑥4 − 𝑦4 2 = 0.95
(𝑐) ℎ
𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 ) = 1.2798
𝑦(1.4) = 1.2798
𝐝𝐲
6. Use Milne’s predictor-corrector method to find 𝐲(𝟎. 𝟒) from = 𝐱 𝟐 + 𝐲 𝟐 , 𝐲(𝟎) =
𝐝𝐱
𝟏, 𝐲(𝟎. 𝟏) = 𝟏. 𝟏𝟏𝟏𝟑, 𝐲(𝟎. 𝟐) = 𝟏. 𝟐𝟓𝟎𝟕, 𝐲(𝟎. 𝟑) = 𝟏. 𝟒𝟐𝟔. Apply the corrector formula
twice.
Solution: By data,
𝑥0 = 0 𝑦0 = 1 𝑦0′ = 𝑥0 2 + 𝑦0 2 =1
𝑥1 = 0.1 𝑦1 = 1.1113 𝑦1′ = 𝑥1 2 + 𝑦1 2 = 1.2450
𝑥2 = 0.2 𝑦2 = 1.2507 𝑦2′ = 𝑥2 2 + 𝑦2 2 = 1.6043
𝑥3 = 0.3 𝑦3 = 1.426 𝑦3′ = 𝑥3 2 + 𝑦3 2 = 2.1235
(𝑝) 4ℎ 2
𝑦4 = 𝑦0 + (2𝑦1′ − 𝑦2′ + 2𝑦3′ ) = 1 + (5.1327) = 1.6844
3 15