Computing Library › Numerical Methods
Numerical Methods

Runge-Kutta Methods

A broad family of one-step time integrators that reach high accuracy by sampling the derivative at several intermediate stages.

One step, several stages

Runge-Kutta methods advance the solution of an ordinary differential equation over one time step by evaluating the right-hand side at several intermediate points (stages) within the step, then combining these evaluations with carefully chosen weights. By sampling the slope at multiple points, they achieve higher accuracy than a single Euler step while remaining self-contained, needing no information from previous steps.

The classic fourth-order method

Kronos motion — family decades

The most famous is the classical fourth-order Runge-Kutta method (RK4), which uses four stages: the slope at the start, two estimates at the midpoint, and one at the end, combined in a weighted average that gives fourth-order accuracy. It offers an excellent balance of accuracy, simplicity, and cost, and remains a default for smooth non-stiff problems.

python
def rk4_step(f, t, y, h):
    k1 = f(t, y)
    k2 = f(t + h/2, y + h/2 * k1)
    k3 = f(t + h/2, y + h/2 * k2)
    k4 = f(t + h,   y + h   * k3)
    return y + h/6 * (k1 + 2*k2 + 2*k3 + k4)

Explicit, implicit, and embedded

Choosing a method

For smooth non-stiff problems an explicit adaptive pair like Dormand-Prince (the basis of many default ODE solvers) is ideal. For stiff problems, implicit Runge-Kutta or backward-differentiation formulas are required for stability without tiny steps; when stiffness comes from a linear operator, IMEX and exponential integrators can be more efficient. For Hamiltonian systems, symplectic Runge-Kutta variants preserve long-term structure. The Butcher tableau compactly encodes any Runge-Kutta method's stages and weights.