Local error estimator (source code)

= Local error estimator
{title2=$\widehat e_{n+1}$}

A local error estimator approximates a numerical step's defect from the exact solution starting at the same input. Differences between formulas estimate error only after their asymptotic orders and constants are accounted for. <Step-doubling error estimation>, an <embedded Runge-Kutta pair> and <predictor-corrector error estimation> are common constructions. They do not by themselves bound accumulated <global error>.

Let $\Phi_h(t_n,y_n)$ be the exact endpoint of the <ordinary differential equation> started at the numerical value $y_n$, and let $Y_{n+1}$ be the candidate numerical endpoint. The signed local defect being estimated is $\ell_{n+1}=\Phi_h(t_n,y_n)-Y_{n+1}$. In contrast, actual <global error> compares $Y_{n+1}$ with the solution of the original <initial value problem>, including all previous steps. The <local truncation error> convention inserts original exact data instead. These starting-value distinctions matter even when the same formula is used for every step. A practical <local error estimator> also relies on a smooth <Taylor expansion>; a small difference can reflect accidental cancellation rather than a rigorous upper bound.