Truncation error (source code)

= Truncation error
{wiki}

<Truncation error> is introduced by replacing an exact operation with a finite approximation. It remains even when all arithmetic is exact. For $f(x)=x^2$, the forward <finite difference> for its <derivative> at $x=1$ gives
$$
\frac{f(1+h)-f(1)}h=2+h,\qquad f'(1)=2.
$$
Thus the <truncation error> is exactly $h$: $h=0.1$ gives $2.1$ and $h=0.01$ gives $2.01$. In finite precision, however, the numerator subtracts nearly equal values, and their <roundoff error> can be amplified by division by $h$. For smooth data with bounded evaluation errors of scale $u$, a typical bound has competing terms $C_1h+C_2u/h$. Smaller $h$ reduces the first term and increases the second; with fixed positive constants the balancing scale is $h\sim\sqrt u$. This is why blindly refining a <finite difference> eventually stops improving it.