Professional Documents
Culture Documents
General Runge Kutta Formulas
General Runge Kutta Formulas
k1 = hf (xi; yi )
1 1
k2 = hf (xi + h; yi + k1)
2 2
1 1
k3 = hf (xi + h; yi + k2)
2 2
k4 = hf (xi + h; yi + k3)
1 1 1 1
yi+1 = yi + k1 + k2 + k3 + k4
6 3 3 6
Example 1 Let’s illustrate a dynamical system using h, with
a 4th order RK numerical solution, then we will compare
with the actual exact solution. What is this dynamic sys-
tem?
dz1
x =y dt = z2
0
dz2
y = ¡x = ¡z1
0
or dt ;
x(0) = 0 z1(0) = 0
y(0) = 1 z2(0) = 1
Note in our RK equations above, we advance ahead by
incrementing xi by stepsize (typically for dynamic systems
we call this time) and calculating incremental values to yi.
In our problem yi is a vector of solutions (or trajectories
over time, one for each 1st ODE) we’re trying to calculate.
So in our problem we have two trajectories z2(t) and z1(t):
so let · ¸
z1
yi of RK formulas= vector zi =
z2
xi of RK formulas=ti
k1 = hf (ti; zi);
k2 = hf (ti + 12 h; zi + 12 k1);
k3 = hf (ti + 12 h; zi + 12 k2);
k4 = hf (ti + h; zi + k3);
zi+1 = zi + 16 k1 + 13 k2 + 13 k3 + 16 k4 · ¸
y(0)
Here f (ti; zi) = f (zi ); and f (z0) =
¡x(0)
h = 0:2 · ¸ · ¸ · ¸
y(0) 1 :2
k1 = 0:2( ) = 0:2 =
·¡x(0)¸ · ¸0 ·0 ¸
0 :2 :1
k2 = 0:2f ( + 0:5 ) =0:2f ( )
· 1
¸ · ¸ 0 1:0
1:0 :2
=0:2 =
¡: 1· ¸ ¡:0 2· ¸
0 :2
k3 = 0:2f ( + 0:5 )
· 1
¸ · ¡:0 2
¸ · ¸
:1 : 99 : 198
=0:2f ( ) = 0:2 =
: 99
· ¸ · ¡: 1¸ ¡:0
·2 ¸
0 : 198 : 198
k4 = 0:2f ( + ) = 0:2f ( )
· 1¸ · ¡:0 2 ¸ : 98
:98 : 196
=0:2 =
¡: 198 ¡:0 396
Now i = 0
zi+1 = zi + 16 k1 + 13 k2 + 13 k3 + 16 k4
z1 = z0 + 16 k1 + 13 k2 + 13 k3 + 16 k4
· ¸
x
= 0 + 16 k1 + 13 k2 + 13 k3 + 16 k4
·y0 ¸ · ¸ · ¸ · ¸
0 :2 :2 : 198
= + 16 + 13 + 13 + 1
· 1¸ · 0 ¸ ¡:0 2 ¡:0 2 6
: 196 : 19867
=
¡:0 396 · : 98007 ¸ · ¸ · ¸
x(0:2) x1 : 19867
so we have ¼ =
y(0:2)
· ¸ ·y1 ¸ : 98007
z1 sin t
Exact solution is =
z2 cos t
sin(0:2) = : 19867
cos(0:2) = : 98007
1
0.5
-1 -0.5 00 0.5 1
-0.5
(sin t; cos t)
-1
0.5
-1 -0.5 00 0.5 1
-0.5
-1