Embedded Runge-Kutta pair (source code)

= Embedded Runge-Kutta pair

Two <Runge Kutta methods> share a stage matrix and nodes but use different output weights. An order-$p$ and order-$q$ pair with $q<p$ gives an output difference generally of order $h^{q+1}$, estimating the lower-order defect. Shared stage evaluations reduce the cost. The <adaptive step-size controller> exponent must reflect this estimator order, rather than blindly the higher reported solution order.

Using the slope convention for <Runge-Kutta stages>, an <embedded Runge-Kutta pair> computes
$$
Y^{[p]}=y_n+h\sum_{i=1}^sb_i k_i,\qquad Y^{[q]}=y_n+h\sum_{i=1}^s\widehat b_i k_i,\qquad d=Y^{[p]}-Y^{[q]}=h\sum_{i=1}^s(b_i-\widehat b_i)k_i.
$$
Its <Butcher tableau> has two output rows, $b^T$ and $\widehat b^T$. Evaluating $f$ is often the expensive part of solving an <ordinary differential equation>; after the shared slopes have been computed, the extra row needs only another linear combination.<Fundamentals of Numerical Computation by Tobin A. Driscoll and others/6.5 Adaptive Runge-Kutta>[§6.5.2, embedded formulas and equation 6.5.5: common stages and two output rows]{ref}

Write $\Phi$ for the exact endpoint from the current numerical state, and define signed local defects $\ell_q=\Phi-Y^{[q]}$ and $\ell_p=\Phi-Y^{[p]}$. Then $d=\ell_q-\ell_p$. If $\ell_q=C_qh^{q+1}+O(h^{q+2})$ and $\ell_p=O(h^{p+1})$, with $C_q\ne0$, the difference reproduces the leading lower-order defect. It does not reproduce the leading higher-order defect. Here the powers use <big O notation> and a smooth <Taylor expansion>; a vanishing leading coefficient or accidental cancellation can make the estimate misleading.

A common choice accepts $Y^{[p]}$ after testing $d$ with <absolute and relative error tolerances>. With the scale approximately unchanged on a retry, the <adaptive step-size controller> uses exponent $1/(q+1)$. Accepting a better endpoint does not change the power in the quantity being tested. The <Euler-Heun embedded pair> makes this visible without a large coefficient table.<Fundamentals of Numerical Computation by Tobin A. Driscoll and others/6.5 Adaptive Runge-Kutta>[§6.5.1, equations 6.5.1–6.5.3 and Algorithm 6.5.1: lower-order local estimate and higher-order accepted output]{ref}