Skip to main content

Module rk4

Module rk4 

Source
Expand description

Classical fourth-order Runge-Kutta method (RK4).

Uses the Butcher tableau:

k1 = f(x_n,       y_n)
k2 = f(x_n + h/2, y_n + h·k1/2)
k3 = f(x_n + h/2, y_n + h·k2/2)
k4 = f(x_n + h,   y_n + h·k3)
y_{n+1} = y_n + (h/6)(k1 + 2k2 + 2k3 + k4)

Global truncation error: O(h⁴).

Functions§

solve
Solve an IVP using the classical RK4 method.