Numerical Methods for ODEs

embedded Runge-Kutta (RKF45)

/ RKF45 (ar-kay-EF-forty-five) /

Adaptive step control needs an estimate of the error in each step — but estimating error usually means doing extra work, like computing the step a second way. Embedded Runge-Kutta methods pull off a brilliant economy: they compute TWO Runge-Kutta results of different order from the SAME set of slope evaluations, just blended with two different sets of weights. The difference between the two results is a nearly-free estimate of the error, with no extra slope evaluations at all. You get the error gauge built right in.

Precisely, an embedded pair shares its stage slopes k1, k2, ... and combines them once with one set of weights to give an order-p estimate, and again with another set to give an order-(p+1) estimate. The gap between them estimates the local error of the lower-order result. The classical example is Runge-Kutta-Fehlberg of orders 4 and 5 — RKF45 — which uses six slope evaluations per step to produce both a 4th- and a 5th-order value; their difference drives the step-size controller. (Modern variants like Dormand-Prince, the engine behind many default solvers, refine the same idea with better coefficients.)

Embedded Runge-Kutta pairs are the standard machinery inside the everyday adaptive solvers people actually run — the ode45-style routines. They marry the robustness and self-starting convenience of Runge-Kutta with a cheap, reliable error estimate, which together make automatic, accuracy-controlled integration practical. The honest caveat is the same as for all adaptivity: the difference between the two embedded results estimates the LOCAL error, and it is only an estimate — usually excellent, but it can occasionally mislead on pathological problems, and it does nothing about stiffness, where you still need an implicit solver.

RKF45 computes six stage slopes per step, then forms a 4th-order value y4 and a 5th-order value y5 from the SAME six slopes with different weights. The error estimate is simply |y5 - y4|; if it is too big the step shrinks, if tiny the step grows — all without a single extra evaluation of f.

Two orders from one set of slopes — the error estimate comes nearly free.

The embedded difference estimates the LOCAL error of the lower-order solution, not the global error, and it assumes the higher-order result is the 'truth.' It is a heuristic, and it offers no help with stiffness — for that you still need an implicit method.

Also called
Runge-Kutta-Fehlbergembedded RK pair龍格-庫塔-費爾貝格法內嵌 RK 對