Professional Documents
Culture Documents
RK 4th Order Method
RK 4th Order Method
Sivaselvi K
Department of Mechanical Engineering,
Amrita Vishwa Vidyapeetham, Amritapuri
Introduction
Runge-Kutta (RK) methods is a numerical technique used to solve ordinary
differential equation of the form
Fourth-Order Runge-Kutta Method
The following is the most commonly used form, and we therefore call it the
classical fourth-order RK method:
1
𝑦𝑖+1 = 𝑦𝑖 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
where
𝑘1 = 𝑓 𝑥𝑖, 𝑦𝑖
1 1
𝑘2 = 𝑓 𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘1 ℎ
2 2
1 1
𝑘3 = 𝑓 𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘2ℎ
2 2
𝑘4 = 𝑓 𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘3ℎ
Fourth-Order Runge-Kutta Method
Solution:
1
𝑦𝑖+1 = 𝑦𝑖 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
𝑖 = 0, 𝑥𝑜 = 0, 𝑦0 = 1, ℎ = 0.5
𝑘1 = 𝑓 𝑥𝑖, 𝑦𝑖
= 𝑓 0,1
= −2(0)3 + 12(0)2 − 20(0) + 8.5
= 8.5
Example
1 1
𝑘2 = 𝑓 𝑥0 + ℎ, 𝑦0 + 𝑘1 ℎ
2 2
1 1
= 𝑓 0 + (0.5), 1 + (8.5)(0.5)
2 2
= 𝑓 0.25,3.125
= 4.21875
Example
1 1
𝑘3 = 𝑓 𝑥0 + ℎ, 𝑦0 + 𝑘2ℎ
2 2
1 1
= 𝑓 0 + (0.5), 1 + (4.21875)(0.5)
2 2
= 𝑓 0.25,2.055
= 4.21875
Example
𝑘4 = 𝑓 𝑥0 + ℎ, 𝑦0 + 𝑘3 ℎ
= 𝑓 0 + 0.5,1 + (4.21875)(0.5)
= 𝑓 0.5,3.1094
= 1.25
1
𝑦1 = 𝑦0 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
1
= 1 + 8.5 + 2(4.21875) + 2(4.21875) + 1.25 0.5
6
𝑦(0.5) = 3.21875
Example
A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K.
Assuming heat is lost only due to radiation, the differential equation for the
temperature of the ball is given by
𝑑𝜃
= −2.2067 × 10−12 (𝜃 4 − 81 × 108)
𝑑𝑡
where θ is in K and t in seconds. Find the temperature at t = 480 seconds using
Runge-Kutta 4th order method. Assume a step size of h = 240 seconds
Solution:
𝑑𝜃
= −2.2067 × 10−12 (𝜃 4 − 81 × 108)
𝑑𝑡
𝑓(𝑡, 𝜃) = −2.2067 × 10−12 (𝜃 4 − 81 × 108)
Example
1
𝜃𝑖+1 = 𝜃𝑖 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
𝑖 = 0, 𝑡𝑜 = 0, 𝜃0 = 1200
𝑘1 = 𝑓 𝑡0, 𝜃0
= 𝑓 0,1200
= −4.5579
Example
1 1
𝑘2 = 𝑓 𝑡0 + ℎ, 𝜃0 + 𝑘1ℎ
2 2
1 1
= 𝑓 0 + (240), 1200 + (−4.5579)(240)
2 2
= 𝑓 120,653.05
= −0.38347
Example
1 1
𝑘3 = 𝑓 𝑡0 + ℎ, 𝜃0 + 𝑘2 ℎ
2 2
1 1
= 𝑓 0 + (240), 1200 + (−0.38347)(240)
2 2
= 𝑓 120,1154.0
= −3.8954
Example
𝑘4 = 𝑓 𝑡0 + ℎ, 𝜃0 + 𝑘3 ℎ
= 𝑓 0 + 240,1200 + (−3.894)(240)
= 𝑓 240,265.10
= 0.0069750
Example
1
𝜃1 = 𝜃0 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
1
= 1200 + −4.5579 + 2(−0.38347) + 2(−3.8954) + 0.0069750 240
6
= 675.65 𝐾
Example
𝑖 = 1, 𝑡1 = 240, 𝜃1 = 675.65 𝐾
𝑘1 = 𝑓 𝑡1, 𝜃1
= 𝑓 240,675.65
= −0.44199
Example
1 1
𝑘2 = 𝑓 𝑡1 + ℎ, 𝜃1 + 𝑘1 ℎ
2 2
1 1
= 𝑓 240 + (240), 675.65 + (−0.44199)(240)
2 2
= 𝑓 360, 622.61
= −0.31372
Example
1 1
𝑘3 = 𝑓 𝑡1 + ℎ, 𝜃1 + 𝑘2ℎ
2 2
1 1
= 𝑓 240 + (240), 675.65 + (−0.31372)(240)
2 2
= 𝑓 360,638.00
= −0.34775
Example
𝑘4 = 𝑓 𝑡1 + ℎ, 𝜃1 + 𝑘3ℎ
= 𝑓 480,592.19
= −0.25351
Example
1
𝜃2 = 𝜃1 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ℎ
6
1
= 675.65 + −0.44199 + 2(−0.31372) + 2(−0.34775) + (−0.25251) 240
6
1
= 675.65 + (−2.0184) × 240
6
= 594.91 𝐾
References
• Steven Chapra and Raymond Canale – ‘Numerical Methods for Engineers’ -
McGraw Hill - 2009 - 6th Edition
• Autar K Kaw – ‘Numerical Methods with Applications’ - Second Edition, 2010