Adaptive step size

In mathematics and numerical analysis, an adaptive step size is used in some methods for the numerical solution of ordinary differential equations (including the special case of numerical integration) in order to control the errors of the method and to ensure stability properties such as A-stability.

Using an adaptive stepsize is of particular importance when there is a large variation in the size of the derivative.

For example, when modeling the motion of a satellite about the earth as a standard Kepler orbit, a fixed time-stepping method such as the Euler method may be sufficient.

However things are more difficult if one wishes to model the motion of a spacecraft taking into account both the Earth and the Moon as in the Three-body problem.

There, scenarios emerge where one can take large time steps when the spacecraft is far from the Earth and Moon, but if the spacecraft gets close to colliding with one of the planetary bodies, then small time steps are needed.

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.

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.

Let us now apply Euler's method again with a different step size to generate a second approximation to y(tn+1).

In reality its rate of change is proportional to

Subtracting solutions gives the error estimate: This local error estimate is third order accurate.

The local error estimate can be used to decide how stepsize

is a safety factor to ensure success on the next try.

The minimum and maximum are to prevent extreme changes from the previous stepsize.

, we consider the step successful, and the error estimate is used to improve the solution: 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.

, this theory facilitates our controllable integration of the ODE from point

, using an optimal number of steps given a local error tolerance.

A drawback is that the step size may become prohibitively small, especially when using the low-order Euler method.

These methods are considered to be more computationally efficient, but have lower accuracy in their error estimates.

To illustrate the ideas of embedded method, consider the following scheme which update

For embedded RK method, computation of

includes a lower order RK method

: The parameter q is the order corresponding to the RK method

The above prediction formula is plausible in a sense that it enlarges the step if the estimated local error is smaller than the tolerance and it shrinks the step otherwise.

The description given above is a simplified procedures used in the stepsize control for explicit RK solvers.

A more detailed treatment can be found in Hairer's textbook.

[1] The ODE solver in many programming languages uses this procedure as the default strategy for adaptive stepsize control, which adds other engineering parameters to make the system more stable.

This shows the computational time in real time used during a 3-body simulation evolved with the Runge-Kutta-Fehlberg method. Most of the computer time is spent when the bodies pass close by and are susceptible to numerical error .