Explicit Runge-Kutta Methods#

This module provides explicit Runge-Kutta methods for ODEs.

Given an initial value problem specified as:

\[\frac{dy}{dt}=f(t,y),\quad y(t_{0})=y_{0}.\]

Let the step-size \(h > 0\).

Then, the general schema of explicit Runge–Kutta methods is 1:

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

where

\[\begin{split}\begin{aligned} k_{1}&=f(t_{n},y_{n}),\\ k_{2}&=f(t_{n}+c_{2}h,y_{n}+h(a_{21}k_{1})),\\ k_{3}&=f(t_{n}+c_{3}h,y_{n}+h(a_{31}k_{1}+a_{32}k_{2})),\\ &\\ \vdots \\ k_{s}&=f(t_{n}+c_{s}h,y_{n}+h(a_{s1}k_{1}+a_{s2}k_{2}+\cdots +a_{s,s-1}k_{s-1})). \end{aligned}\end{split}\]

To specify a particular method, one needs to provide the integer \(s\) (the number of stages), and the coefficients \(a_{ij}\) (for \(1 \le j < i \le s\)), \(b_i\) (for \(i = 1, 2, \cdots, s\)) and \(c_i\) (for \(i = 2, 3, \cdots, s\)).

The matrix \([a_{ij}]\) is called the Runge–Kutta matrix, while the \(b_i\) and \(c_i\) are known as the weights and the nodes. These data are usually arranged in a mnemonic device, known as a Butcher tableau (named after John C. Butcher):

\[\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} \end{array}\end{split}\]

A Taylor series expansion shows that the Runge–Kutta method is consistent if and only if

\[\sum _{i=1}^{s}b_{i}=1.\]

Another popular condition for determining coefficients is:

\[\sum_{j=1}^{i-1}a_{ij}=c_{i}{\text{ for }}i=2,\ldots ,s.\]

More details please see references 2 3 4.

1

Press, W. H., B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling. “Section 17.1 Runge-Kutta Method.” Numerical Recipes: The Art of Scientific Computing (2007).

2

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

3

Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2016.

4

Iserles, A., 2009. A first course in the numerical analysis of differential equations (No. 44). Cambridge university press.

ExplicitRKIntegrator(f[, var_type, dt, ...])

Explicit Runge–Kutta methods for ordinary differential equation.

Euler(f[, var_type, dt, name, show_code, ...])

The Euler method for ODEs.

MidPoint(f[, var_type, dt, name, show_code, ...])

Explicit midpoint method for ODEs.

Heun2(f[, var_type, dt, name, show_code, ...])

Heun's method for ODEs.

Ralston2(f[, var_type, dt, name, show_code, ...])

Ralston's method for ODEs.

RK2(f[, beta, var_type, dt, name, ...])

Generic second order Runge-Kutta method for ODEs.

RK3(f[, var_type, dt, name, show_code, ...])

Classical third-order Runge-Kutta method for ODEs.

Heun3(f[, var_type, dt, name, show_code, ...])

Heun's third-order method for ODEs.

Ralston3(f[, var_type, dt, name, show_code, ...])

Ralston's third-order method for ODEs.

SSPRK3(f[, var_type, dt, name, show_code, ...])

Third-order Strong Stability Preserving Runge-Kutta (SSPRK3).

RK4(f[, var_type, dt, name, show_code, ...])

Classical fourth-order Runge-Kutta method for ODEs.

Ralston4(f[, var_type, dt, name, show_code, ...])

Ralston's fourth-order method for ODEs.

RK4Rule38(f[, var_type, dt, name, ...])

3/8-rule fourth-order method for ODEs.