Runge–Kutta methods
Classical Runge-Kutta#
Consider the initial value problem
\[\frac{dy}{dx} = f(t,y),\quad y(t_0)=y_0\]Where \(y = y(t)\) is an unknown function that we would like to approximate.
Pick a step-size \(h>0\) and put
\[y_{n+1} = y_n + \frac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4),\quad t_{n+1} = t_n +h\]where \(n = 0,1,2,\ldots\), and
- \(k_1 = f(t_n, y_n)\)
- \(k_2 = f(t_n + h/2 , y_n + h k_1/2)\)
- \(k_3 = f(t_n + h/2, y_n + h k_2/2)\)
- \(k_4 = f(t_n + h, y_n + hk_3)\)
Greater weight is given to the slopes at the midpoint.
This is also called RK4 method. It is a fourth-order method, meaning that the local truncation error is on the order of \(O(h^5)\) while the total accumulated error is on the order of \(O(h^4)\).