ODE - 4th Order Runge Kutta Method
ODE - 4th Order Runge Kutta Method
th
4 Order Runge-Kutta (RK) Method
1
Objectives
• Solve a First order ODE Using 4th Order Runge − Kutta RK Method
• Runge-Kutta methods are a family of single-point methods
• Runge-Kutta methods are explicit methods
• The Fourth − Order Runge − Kutta RK Method is a popular 4th order
method.
2
The Fourth − Order Runge − Kutta Method
• Δ𝑦1 = ℎ ∗ 𝑓 𝑡𝑛 , 𝑦𝑛
ℎ Δ𝑦1
• Δ𝑦2 = ℎ ∗ 𝑓 𝑡𝑛 + ,𝑦 +
2 𝑛 2
ℎ Δ𝑦2
• Δ𝑦3 = ℎ ∗ 𝑓 𝑡𝑛 + , 𝑦𝑛 +
2 2
• Δ𝑦4 = ℎ ∗ 𝑓 𝑡𝑛 + ℎ, 𝑦𝑛 + Δ𝑦3
The Fourth − Order Runge − Kutta Method
• The (Finite Difference Equations) FDEs are explicit and require four derivative
function evaluations per step.
• The FDEs are consistent and conditionally stable, and thus, convergent.
• y = - 0.5 * 𝑥 4 + 4 * 𝑥 3 - 10 *𝑥 2 + 8.5 * 𝑥 + 1
The Fourth − Order Runge − Kutta Method
• fn = - 2 * 𝑥 3 + 12 * 𝑥 2 - 20 * 𝑥 + 8.5 ; y(x=0) = 1;
• Let n = 0;
• Δ𝑦1 = ℎ ∗ 𝑓 𝑡𝑛 , 𝑦𝑛 = ℎ ∗ 𝑓 𝑡0 , 𝑦0 = ℎ ∗ 𝑓 0,1
= 0.5 * (- 2 * 03 + 12 * 02 - 20 * 0 + 8.5) = 4.25
ℎ Δ𝑦1 0.5 Δ𝑦1
• Δ𝑦2 = ℎ ∗ 𝑓 𝑡𝑛 + , 𝑦𝑛 + = ℎ ∗ 𝑓 𝑡0 + , 𝑦0 +
2 2 2 2
Δ𝑦1
= ℎ ∗ 𝑓 0.25, 𝑦0 +
2
Δ𝑦2
= ℎ ∗ 𝑓 0.25, 𝑦0 + = 2.109375 (same as previous step)
2
1
• 𝑦𝑛+1 = 𝑦𝑛 + * Δ𝑦1 + 2 ∗ Δ𝑦2 + 2 ∗ Δ𝑦3 + Δ𝑦4
6
• Let n = 0
1
• 𝑦1 = 𝑦0 + * Δ𝑦1 + 2 ∗ Δ𝑦2 + 2 ∗ Δ𝑦3 + Δ𝑦4
6
1
• 𝑦1 = 1 + * 4.25 + 2 ∗ 2.109375 + 2 ∗ 2.109375 + 0.625
6
• 𝑦1 = 3.21875