next up previous index
Next: Example Code Up: The Fourth-Order Runge-Kutta Method Previous: Example Code

Adaptive Stepsize Control

In order to assess the accuracy of numerical integration, and possibly adjust the stepsize so as to maintain the requested accuracy employ step doubling:

1.
take the step twice
(a)
once as a full step, leading to $x_1(t + \Delta t)$
(b)
then as two half steps, leading to $x_2(t + \Delta t)$
2.
Estimate the truncation error by

\begin{displaymath}\Delta x (\Delta t) = x_2(t + \Delta t) - x_1(t + \Delta t)
\approx {\cal O}\left( (\Delta t)^5 \right)
\end{displaymath}

3.
Return $x_2(t + \Delta t)$ as an answer, because that's going to be the more accurate one.
4.
Since $\Delta x \approx {\cal O}\left( (\Delta t)^5 \right)$ assuming that we try two different values of $\Delta t$ we should have:

\begin{displaymath}\frac{(\Delta x)_0}{(\Delta x)_1}
= \left(
\frac{(\Delta t)_0}{(\Delta t)_1}
\right)^5
\end{displaymath}

This yields the following formula for a step size:

 \begin{displaymath}
(\Delta t)_0 =
(\Delta t)_1
\left\vert\frac{(\Delta x)_0}{(\Delta x)_1}\right\vert^{1/5}
\end{displaymath} (4.78)

Strategy
Let $(\Delta x)_0$ be the requested accuracy.


next up previous index
Next: Example Code Up: The Fourth-Order Runge-Kutta Method Previous: Example Code
Zdzislaw Meglicki
2001-02-26