## Error Control

An ideal difference-equation method:

\begin{aligned} \omega_0 & = \alpha \\ \omega_{i+1} & = \omega_i + hT^n(t_i,\omega_i), \quad i=0,\dots,N-1 \\ \end{aligned} \label{eq:ec1}

for approximating the solution $$y(t)$$ to the initial value problem:

$$\frac{dy}{dt} = f(t,y), \quad a \leq t \leq b, \quad y(t_0) = y_0 \\ \label{eq:ec2}$$

would have the property that, given a tolerance $$\epsilon > 0$$, the minimum number of mesh points would be used to ensure that the global error $$|y_i - \omega_i|$$, would not exceed $$\epsilon$$ for any $$i=0,\dots\,N-1$$. Ensuring that the minimum number of mesh points is used to generate an approximation to the solution $$y(t)$$ on an interval $$[a,b]$$ is inconsistent with the mesh points being equally spaced. In general, the global error of a method cannot be determined. However, as there is a close relationship between the global error and the local truncation error of a method, and by using methods of differing order, a prediction as to the magnitude of the local truncation can be made, therefore allowing selection of a step size that will ensure both the global and local truncation errors remain within some predefined bounds.

To illustrate this technique, consider two approximation techniques. The first is an $$n^{th}$$ order Taylor method with a difference-equation of the form:

\begin{aligned} \omega_0 & = \alpha \\ \omega_{i+1} & = \omega_i + hT^n(t_i,\omega_i), \quad i=0,\dots,N-1 \\ \end{aligned} \label{eq:ec3}

with local truncation error $$\tau_{i+1}(h) = O(h^n)$$. The second is an $$(n+1)^{th}$$ order Taylor method with a difference-equation of the form:

\begin{aligned} \overline{\omega}_0 & = \alpha \\ \overline{\omega}_{i+1} & = \overline{\omega}_i + hT^n(t_i,\overline{\omega}_i), \quad i=0,\dots,N-1 \\ \end{aligned} \label{eq:ec4}

with local truncation error $$\overline{\tau}_{i+1}(h) = O(h^{n+1})$$. Assuming that $$\omega_i \approx y(t_i) \approx \overline{\omega}_i$$ and using a fixed step size $$h$$ to generate approximations $$\omega_{i+1}$$ and $$\overline{\omega}_{i+1}$$ to $$y(t_{i+1})$$, then from the definition of the local truncation error of a Taylor method approximation:

\begin{aligned} \tau_{i+1}(h) & = \frac{y_{i+1} - y_i}{h_i} - T^n(t_i,y_i) \\ & = \frac{y_{i+1} - \omega_i}{h_i} - T^n(t_i,y_i) \\ & = \frac{y_{i+1} - \left[\omega_i + h_iT^n(t_i,y_i)\right]}{h_i} \\ & = \frac{1}{h_i}\left[y_{i+1} - \omega_{i+1}\right] \\ \end{aligned} \label{eq:ec5}

In a similar manner:

$$\overline{\tau}_{i+1}(h) = \frac{1}{h_i}\left[y_{i+1} - \overline{\omega}_{i+1}\right]\\ \label{eq:ec6}$$

Rewriting $$\tau_{i+1}(h)$$ in terms of $$\overline{\tau}_{i+1}(h)$$:

\begin{aligned} \tau_{i+1}(h) & = \frac{1}{h_i}\left[y_{i+1} - \omega_{i+1}\right] \\ & = \frac{1}{h_i}\left[(y_{i+1} - \overline{\omega}_{i+1}) + (\overline{\omega}_{i+1} - \omega_{i+1})\right] \\ & = \overline{\tau}_{i+1}(h) + \frac{1}{h_i}(\overline{\omega}_{i+1} - \omega_{i+1}) \\ \end{aligned} \label{eq:ec7}

and since $$\tau_{i+1}(h)$$ is $$O(h^n)$$ and $$\overline{\tau}_{i+1}(h)$$ is $$O(h^{n+1})$$, the dominant term in \eqref{eq:ec7} is equivalent to $$\frac{1}{h_i}(\overline{\omega}_{i+1} - \omega_{i+1})$$. This allows an easily computed approximation to the local truncation error of the $$O(h^n)$$ Taylor method which may be written as:

$$\tau_{i+1}(h) \approx \frac{1}{h_i}(\overline{\omega}_{i+1} - \omega_{i+1}) \\ \label{eq:ec8}$$

Approximation \eqref{eq:ec8} to the local truncation error may be used to adjust the step size to keep it within a specified upper bound. Assuming that since $$\tau_{i+1}(h)$$ is $$O(h^n)$$, a number $$K$$, independent of $$h_i$$ exists with:

$$\tau_{i+1}(h) \approx K{h_i}^n \\ \label{eq:tc9}$$

The local truncation error produced by applying the $$n^{th}$$ order method with a new step size $$qh_i$$ can be estimated using the original approximations $$\omega_{i+1}$$ and $$\overline{\omega}_{i+1}$$:

$$\tau_{i+1}(qh_i) \approx K{(qh_i)}^n = q^n{(Kh_i)}^n \approx q^n\tau_{i+1}(h_i) \approx \frac{q^n}{h_i}(\overline{\omega}_{i+1} - \omega_{i+1}) \\ \label{eq:tc10}$$

To bound $$\tau_{i+1}(qh_i)$$ by $$\epsilon$$, $$q$$ may be chosen such that:

$$\frac{q^n}{h_i}|(\overline{\omega}_{i+1} - \omega_{i+1}| \approx |\tau_{i+1}(qh_i)| \le \epsilon \\ \label{eq:tc11}$$

and therefore:

$$q \le \left(\frac{\epsilon h_i}{|\overline{\omega}_{i+1} - \omega_{i+1}|}\right)^{\frac{1}{n}}\\ \label{eq:tc12}$$

Therefore, if the initial choice of $$h$$ at the $$i^{th}$$ step results in a local truncation error that exceeds $$\epsilon$$, then the step size may be adjusted and the approximations recalculated.