Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
RUNGE-KUTTA’S METHOD
1. Second order
1
𝑦𝑛+1 = 𝑦𝑛 + 𝑘1 + 𝑘2
2
where 𝑘1 = ℎ𝑓 𝑥𝑛 , 𝑦𝑛
𝑘2 = ℎ𝑓 𝑥𝑛 + ℎ, 𝑦𝑛 + 𝑘1
2. Fourth order
1
𝑦𝑛+1 = 𝑦𝑛 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4
6
where 𝑘1 = ℎ𝑓 𝑥𝑛 , 𝑦𝑛
ℎ 𝑘1
𝑘2 = ℎ𝑓 𝑥𝑛 + , 𝑦𝑛 +
2 2
ℎ 𝑘2
𝑘3 = ℎ𝑓 𝑥𝑛 + , 𝑦𝑛 +
2 2
𝑘4 = ℎ𝑓 𝑥𝑛 + ℎ, 𝑦𝑛 + 𝑘3
Problem 1
𝑑𝑦
Given = 𝑥 + 𝑦, with initial conditions 𝑦 0 = 1. Choose ℎ = 0.1 and find
𝑑𝑥
𝑦 0.1 , 𝑦 0.2 and 𝑦 0.3 using Runge-Kutta’s method of fourth order.
Putting 𝑛 = 0 in Runge-Kutta’s formula for fourth order, we get
1
𝑦1 = 𝑦0 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4
6
where 𝑘1 = ℎ𝑓 𝑥0 , 𝑦0 = 0.1 0 + 1 = 0.1
ℎ 𝑘1
𝑘2 = ℎ𝑓 𝑥0 + , 𝑦0 + = 0.1 0.05 + 1.05 = 0.11
2 2
ℎ 𝑘2
𝑘3 = ℎ𝑓 𝑥0 + , 𝑦0 + = 0.1 0.05 + 1.055 = 0.1105
2 2
𝑘4 = ℎ𝑓 𝑥0 + ℎ, 𝑦0 + 𝑘3 = 0.1 0.1 + 1.1105 = 0.12105
1
𝑦 0.1 = 𝑦1 = 1 + 0.1 + 0.22 + 0.221 + 0.12105 =1.11034
6
Putting 𝑛 = 1 in Runge-Kutta’s formula for fourth order, we get
1
𝑦2 = 𝑦1 + 𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4
6
where 𝑘1 = ℎ𝑓 𝑥1 , 𝑦1 = 0.1 0.1 + 1.11034 = 0.12103
ℎ 𝑘1
𝑘2 = ℎ𝑓 𝑥1 + , 𝑦1 + = 0.13208
2 2
ℎ 𝑘2
𝑘3 = ℎ𝑓 𝑥1 + , 𝑦1 + = 0.13263
2 2
𝑘4 = ℎ𝑓 𝑥1 + ℎ, 𝑦1 + 𝑘3 = 0.14429
𝑦 0.2 = 𝑦2 = 1.2428
𝑛 = 2 will give 𝑦 0.3 = 1.399711
𝑘1 = 0.14428, 𝑘2 = 0.156494, 𝑘3 = 0.157105, 𝑘4 = 0.169990