Numerical implementation of methods for ODEs
For multistep methods, we use a pair of methods of the same order $p$:
-
the predictor: explicit, lower computational cost; and
-
the corrector: implicit, higher accuracy.
The predictor provides a good initial guess in the solution of the implicit corrector equations, and allows for error estimation:
If the local truncation errors are $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^{\text{P}} ={}& c_{\text{P}} h^{p+1} \v y^{(p+1)}(t_n) + O(h^{p+2}), \\ \v y(t_{n+1}) - \v y_{n+1}^{\text{C}} ={}& c_{\text{C}} h^{p+1} \v y^{(p+1)}(t_n) + O(h^{p+2}), \end{align*} $$ then we estimate the error as $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^\text{C} \approx -\frac{c_{\text{C}}}{c_\text{P} - c_\text{C}}(\v y_{n+1}^\text{P} - \v y_{n+1}^{\text{C}}). \end{align*} $$
Runge-Kutta methods do not have a single error constant.
Instead we use two (typically explicit) Runge-Kutta methods:
-
one of $s$ stages and order $p$; and
-
one of $s+l$ stages and order $p+1$,
with the first $s$ stages identical to reduce computational cost. Then we have an estimate of the lower order method $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^{[1]}\approx \v y_{n+1}^{[2]} - \v y_{n+1}^{[1]}. \end{align*} $$
For example $$ \begin{align*} k_1 ={}& f(t_n, y_n), \\ k_2 ={}& f(t_n + \frac{1}{2}h, y_n + \frac{1}{2}hk_1), \\ k_3 ={}& f(t_n + h, y_n - hk_1 + 2hk_2), \\ y_{n+1}^{[1]} ={}& y_n + hk_2, \\ y_{n+1}^{[2]} ={}& y_n + \frac{1}{6}h(k_1 + 4k_2 + k_3). \end{align*} $$ $y_{n+1}^{[1]}$ has order $2$ accuracy, and $y_{n+1}^{[2]}$ has order $3$ accuracy.
Suppose the ODE $\v y'(t) = \v f(t, \v y)$ is solved by an arbitrary numerical method of order $p$, and we have stored some past values $\v y_n, \v y_{n-1}, \ldots, \v y_{n-p}$.
Let $\v q\in \mathcal{P}_p$ be a polynomial that interpolates $\v q(t_i) = \v y_i$ for $i=n,\ldots,n-p$. Then $\v q(t) - \v y(t) = O(h^{p+1})$. Note $\v q$ solves a new ODE $$ \begin{align*} \v z' = \v f(t,\v z) + \underbrace{\v q' - \v f(t, \v q)}_{\text{small}}, \tag{*} \end{align*} $$ which slightly differs from our original ODE by a term $\v q' - \v y'$ which we expect to be small.
Now apply the same method to produce $\v z_{n+1}$. The Zadunaisky device estimates the local truncation error of $\v y_{n+1}$ as $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1} \approx \v q(t_{n+1}) - \v z_{n+1}. \end{align*} $$