This module provides adaptive Runge-Kutta methods for ODEs.

Adaptive methods are designed to produce an estimate of the local truncation error of a single Runge–Kutta step. This is done by having two methods, one with order $$p$$ and one with order $$p-1$$. These methods are interwoven, i.e., they have common intermediate steps. Thanks to this, estimating the error has little or negligible computational cost compared to a step with the higher-order method.

During the integration, the step size is adapted such that the estimated error stays below a user-defined threshold: If the error is too high, a step is repeated with a lower step size; if the error is much smaller, the step size is increased to save time. This results in an (almost) optimal step size, which saves computation time. Moreover, the user does not have to spend time on finding an appropriate step size.

The lower-order step is given by

$y_{n+1}^{*}=y_{n}+h\sum _{i=1}^{s}b_{i}^{*}k_{i},$

where $$k_{i}$$ are the same as for the higher-order method. Then the error is

$e_{n+1}=y_{n+1}-y_{n+1}^{*}=h\sum _{i=1}^{s}(b_{i}-b_{i}^{*})k_{i},$

which is ($$O(h^{p}$$).

The Butcher tableau for this kind of method is extended to give the values of $$b_{i}^{*}$$:

$\begin{split}\begin{array}{c|llll} 0 & & & & & \\ c_{2} & a_{21} & & & & \\ c_{3} & a_{31} & a_{32} & & & \\ \vdots & \vdots & & \ddots & \\ c_{s} & a_{s 1} & a_{s 2} & \cdots & a_{s, s-1} \\ \hline & b_{1} & b_{2} & \cdots & b_{s-1} & b_{s} \\ & b_{1}^{*} & b_{2}^{*} & \cdots & b_{s-1}^{*} & b_{s}^{*} \end{array}\end{split}$

More details please check 1 2 3.

1

https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods

2

Press, W.H., Press, W.H., Flannery, B.P., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P. and Vetterling, W.T., 1989. Numerical recipes in Pascal: the art of scientific computing (Vol. 1). Cambridge university press.

3

Press, W. H., & Teukolsky, S. A. (1992). Adaptive Stepsize Runge‐Kutta Integration. Computers in Physics, 6(2), 188-191.

 AdaptiveRKIntegrator(f[, var_type, dt, ...]) Adaptive Runge-Kutta method for ordinary differential equations. RKF12(f[, var_type, dt, name, adaptive, ...]) The Fehlberg RK1(2) method for ODEs. RKF45(f[, var_type, dt, name, adaptive, ...]) The Runge–Kutta–Fehlberg method for ODEs. DormandPrince(f[, var_type, dt, name, ...]) The Dormand–Prince method for ODEs. CashKarp(f[, var_type, dt, name, adaptive, ...]) The Cash–Karp method for ODEs. BogackiShampine(f[, var_type, dt, name, ...]) The Bogacki–Shampine method for ODEs. HeunEuler(f[, var_type, dt, name, adaptive, ...]) The Heun–Euler method for ODEs.