In numerical analysis, some methods for the numerical solution of ordinary differential equations (including the special case of numerical integration) use an adaptive stepsize in order to control the errors of the method and to ensure stability properties such as A-stability. Romberg's method is an example of a numerical integration method which uses an adaptive stepsize.
Contents
Example
For simplicity, the following example uses the simplest integration method, the Euler method; in practice, higher-order methods such as Runge–Kutta methods are preferred due to their superior convergence and stability properties.
Consider the initial value problem
where y and f may denote vectors (in which case this equation represents a system of coupled ODEs in several variables).
We are given the function f(t,y) and the initial conditions (a, ya), and we are interested in finding the solution at t=b. Let y(b) denote the exact solution at b, and let yb denote the solution that we compute. We write
For a sequence (tn) of values of t, with tn = a + nh, the Euler method gives approximations to the corresponding values of y(tn) as
The local truncation error of this approximation is defined by
and by Taylor's theorem, it can be shown that (provided f is sufficiently smooth) the local truncation error is proportional to the square of the step size:
where c is some constant of proportionality.
We have marked this solution and its error with a
The value of c is not known to us. Let us now apply Euler's method again with a different step size to generate a second approximation to y(tn+1). We get a second solution, which we label with a
Here, we assume error factor
This local error estimate is third order accurate.
The local error estimate can be used to decide how stepsize
The
This solution is actually third order accurate in the local scope (second order in the global scope), but since there is no error estimate for it, this doesn't help in reducing the number of steps. This technique is called Richardson extrapolation.
Beginning with an initial stepsize of
Similar methods can be developed for higher order methods, such as the 4th order Runge-Kutta method. Also, a global error tolerance can be achieved by scaling the local error to global scope.
Embedded error estimates
Adaptive stepsize methods that use a so-called 'embedded' error estimate include the Runge–Kutta–Fehlberg, Cash–Karp and Dormand–Prince methods. These methods are considered to be more computationally efficient, but have lower accuracy in their error estimates.