4th Order Runge Kutta Eample Edit 16
4th Order Runge Kutta Eample Edit 16
4th Order Runge Kutta Eample Edit 16
f3
f1 f
1
f f1 2 f 2 2 f 3 f 4
6
xi xi + h/2 xi + h
Runge-Kutta Method
th
(4 Order) Example
Consider Exact Solution
2 x
dy 2 y 2 2x x e
yx
dx
The initial condition is: y 0 1
The step size is:
h 0.1
th
The 4 Order Runge-Kutta
The example of a single step:
k1 h f x, y 0.1 f 0,1 0.1 1 0 2 0.1
1 1
k 2 h f x h, y k1 0.1 f 0.05,1.05 0.10475
2 2
1 1
k3 h f x h, y k 2 0.1 f 0.05,1. k 2 / 2 0.104988
2 2
k 4 h f x h, y k3 0.1 f 0.1,1.104988 0.109499
1
yn 1 yn k1 2k 2 2k3 k 4 1.104829
6
0
Runge-Kutta Method 0 1 2 3 4
Y Value
-2
th
(4 Order) Example
-4
-6 Exact
4th order
-8
solution. If we were to 0
0 1 2 3 4
go out to x=5. -2
Y Value -4
y(5) = -111.4129 (-111.4132)
-6 Exact
4 10.00
Absolute |Error|
0
0 1 2 3 4 6.00
Y Value
-2
-4 4.00
-6 Exact 2.00
2nd order
-8
0.00
4th order
-10 0 1 2 3 4 5
X Value X Value