Skip to content
Oakfield Operator Calculus Function Reference Site

Runge–Kutta–Fehlberg 4(5)

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

k1=F(un,tn),k2=F ⁣(un+14Δtk1,tn+14Δt),k3=F ⁣(un+332Δtk1+932Δtk2,tn+38Δt),k4=F ⁣(un+19322197Δtk172002197Δtk2+72962197Δtk3,tn+1213Δt),k5=F ⁣(un+439216Δtk18Δtk2+3680513Δtk38454104Δtk4,tn+Δt),k6=F ⁣(un827Δtk1+2Δtk235442565Δtk3+18594104Δtk41140Δtk5,tn+12Δt)\begin{aligned} k_1 &= F(u^{n}, t_n),\\ k_2 &= F\!\left(u^{n} + \tfrac{1}{4}\Delta t\,k_1,\, t_n + \tfrac{1}{4}\Delta t\right),\\ k_3 &= F\!\left(u^{n} + \tfrac{3}{32}\Delta t\,k_1 + \tfrac{9}{32}\Delta t\,k_2,\, t_n + \tfrac{3}{8}\Delta t\right),\\ k_4 &= F\!\left(u^{n} + \tfrac{1932}{2197}\Delta t\,k_1 - \tfrac{7200}{2197}\Delta t\,k_2 + \tfrac{7296}{2197}\Delta t\,k_3,\, t_n + \tfrac{12}{13}\Delta t\right),\\ k_5 &= F\!\left(u^{n} + \tfrac{439}{216}\Delta t\,k_1 - 8\Delta t\,k_2 + \tfrac{3680}{513}\Delta t\,k_3 - \tfrac{845}{4104}\Delta t\,k_4,\, t_n + \Delta t\right),\\ k_6 &= F\!\left(u^{n} - \tfrac{8}{27}\Delta t\,k_1 + 2\Delta t\,k_2 - \tfrac{3544}{2565}\Delta t\,k_3 + \tfrac{1859}{4104}\Delta t\,k_4 - \tfrac{11}{40}\Delta t\,k_5,\, t_n + \tfrac{1}{2}\Delta t\right) \end{aligned}

The fifth-order solution estimate is

u(5)n+1=un+Δt(16135k1+665612825k3+2856156430k4950k5+255k6)u^{n+1}_{(5)} = u^{n} + \Delta t\left(\tfrac{16}{135}k_1 + \tfrac{6656}{12825}k_3 + \tfrac{28561}{56430}k_4 - \tfrac{9}{50}k_5 + \tfrac{2}{55}k_6\right)

and the embedded fourth-order estimate is

u(4)n+1=un+Δt(25216k1+14082565k3+21974104k415k5)u^{n+1}_{(4)} = u^{n} + \Delta t\left(\tfrac{25}{216}k_1 + \tfrac{1408}{2565}k_3 + \tfrac{2197}{4104}k_4 - \tfrac{1}{5}k_5\right)

The local error estimate is en+1=u(5)n+1u(4)n+1e^{n+1} = u^{n+1}_{(5)} - u^{n+1}_{(4)}.

Applies to unRmu^n \in \mathbb{R}^m (or function spaces) with sufficiently smooth FF to support fifth-order truncation error. Outputs u(5)n+1u^{n+1}_{(5)} and u(4)n+1u^{n+1}_{(4)} lie in the same space.


The difference en+1=u(5)n+1u(4)n+1e^{n+1} = u^{n+1}_{(5)} - u^{n+1}_{(4)} provides a cheap local error proxy that enables adaptive step-size control.

A common controller selects a new step size using a normed tolerance test and

ΔtnewΔt(tolen+1)1/5\Delta t_{\mathrm{new}} \approx \Delta t \left(\frac{\mathrm{tol}}{\|e^{n+1}\|}\right)^{1/5}

where the exponent 1/51/5 reflects the scaling en+1=O(Δt5)\|e^{n+1}\|=\mathcal{O}(\Delta t^5) of the embedded local error estimate.

RKF45 is explicit (no solves) and typically uses six drift evaluations per attempted step. Like other explicit Runge–Kutta schemes, stability restricts timesteps on stiff problems.


For linear F(u,t)=AuF(u,t) = Au, both estimates reduce to applying the stability polynomials to z=Δtλz = \Delta t\,\lambda. As Δt0\Delta t \to 0, the fourth- and fifth-order estimates coincide and converge to the exact flow.


Compared to classical RK4, RKF45 adds an embedded estimator for step-size control. Heun’s method is the two-stage analogue with lower order and no embedded pair.


Oakfield exposes RKF45 as an adaptive built-in explicit integrator:

  • Integrator name: rkf45 (Lua: sim.sim_create_context_integrator(ctx, "rkf45", {...})).
  • Always adaptive: Oakfield forces adaptive = true for RKF45 even if the caller requests a fixed step, since the method relies on embedded error control.
  • Complex + stochastic support: supports complex primary fields and optional stochastic increments after each accepted step.

Fehlberg’s embedded 4(5) construction provided a practical way to estimate local error and adapt step sizes without extra drift evaluations, helping popularize adaptive explicit solvers.

Embedded Runge–Kutta pairs (including RKF-type and Dormand–Prince variants) are now standard workhorses for adaptive nonstiff ODE integration.


  • Hairer, Nørsett, Wanner, Solving Ordinary Differential Equations I
  • Fehlberg, Low-Order Classical Runge-Kutta Formulas with Stepsize Control (NASA TR R-315)