Skip to content
Oakfield Operator Calculus Function Reference Site

Runge–Kutta 4

For ut=F(u,t)u_t = F(u,t) with timestep Δt\Delta t, define

k1=F(un,tn),k2=F ⁣(un+Δt2k1,tn+Δt2),k3=F ⁣(un+Δt2k2,tn+Δt2),k4=F ⁣(un+Δtk3,tn+Δt),\begin{aligned} k_1 &= F(u^{n}, t_n),\\ k_2 &= F\!\left(u^{n} + \tfrac{\Delta t}{2} k_1,\, t_n + \tfrac{\Delta t}{2}\right),\\ k_3 &= F\!\left(u^{n} + \tfrac{\Delta t}{2} k_2,\, t_n + \tfrac{\Delta t}{2}\right),\\ k_4 &= F\!\left(u^{n} + \Delta t\, k_3,\, t_n + \Delta t\right), \end{aligned}

then update

un+1=un+Δt6(k1+2k2+2k3+k4)u^{n+1} = u^{n} + \frac{\Delta t}{6}(k_1 + 2k_2 + 2k_3 + k_4)

Applies to unRmu^n \in \mathbb{R}^m (or function spaces) with sufficiently smooth FF to support fourth-order truncation error. Output un+1u^{n+1} remains in the same space.


Classical RK4 is fourth-order accurate in time, with local truncation error O(Δt5)\mathcal{O}(\Delta t^5).

For the linear test equation ut=λuu_t = \lambda u, the stability polynomial is

R(z)=1+z+12z2+16z3+124z4,z=λΔtR(z) = 1 + z + \tfrac{1}{2}z^2 + \tfrac{1}{6}z^3 + \tfrac{1}{24}z^4, \qquad z = \lambda \Delta t

RK4 is explicit, so stability imposes CFL-like timestep restrictions for many PDE semi-discretizations.

Four drift evaluations per step; no linear or nonlinear solves.


As Δt0\Delta t \to 0, RK4 converges to the exact solution under standard smoothness assumptions. For autonomous linear systems ut=Auu_t = Au, the update corresponds to applying the degree-4 stability polynomial to z=Δtλz=\Delta t\,\lambda for each eigenvalue λ\lambda.


Compared to Crank–Nicolson, RK4 avoids implicit solves but requires smaller timesteps for stiff problems.


Oakfield exposes RK4 as a built-in explicit integrator:

  • Integrator name: rk4 (Lua: sim.sim_create_context_integrator(ctx, "rk4", {...})).
  • Optional adaptivity: when adaptive = true, Oakfield compares an RK4 update against a cheaper Heun estimate to build an error norm for step acceptance.
  • Complex + stochastic support: works for real/complex primary fields and supports optional stochastic increments.

Runge and Kutta developed families of multi-stage explicit schemes in the late 19th and early 20th centuries, providing systematic ways to build higher-order integrators without higher derivatives.

RK4 remains a widely used default explicit integrator due to its simplicity, accuracy per step, and predictable error behavior on smooth nonstiff dynamics.


  • Hairer, Nørsett, Wanner, Solving Ordinary Differential Equations I
  • Butcher, Numerical Methods for Ordinary Differential Equations