4.2. Stability Function of a Runge-Kutta Method#
We have seen that the stability function is the function \(R(z)\) such that \(y_{n+1} = R(z) y_n\) where \(y_{n+1}\) is the single step solution of the test ODE \(y' = \lambda y\) and \(z = h\lambda\). The general form of a Runge-Kutta method is
Let \(Y_i = y_n + h \displaystyle \sum_{j=1}^s a_{ij} k_i\) and applying the method to the test equation \(y' = \lambda y\) we have
Let \(z = h\lambda\) and expanding out the summations in the stage values
We can write these as the matrix equation
Let \(Y = (Y_1 ,Y_2 ,\dots ,Y_s )\) and \(\mathbf{e}=(1,1,\dots ,1)\) then
Expanding the summation in the equation for updating the solution over a single step and using \(z = h \lambda\) gives
which can be written as the matrix equation
The stability functions for explicit and implicit Runge-Kutta methods are derived using different approaches.
4.2.1. Stability function of an explicit Runge-Kutta method#
To derive the stability function of an explicit Runge-Kutta method we rearrange equation (4.3)
and substituting into equation (4.4) gives
so the stability function is
Using the geometric series of matrices
then
This is the stability function for an ERK method.
Definition 4.3 (Stability function of an explicit Runge-Kutta method)
Since the solution to the test equation is \(y = e^{\lambda t}\), over one step of an explicit Runge-Kutta method we would expect the local truncation errors to change at a rate of \(e^z\). The series expansion of \(e^z\) is
Comparing the coefficients of \(z^k\) in equations (4.5) and (4.6) we have
which must be satisfied up to the \(k\)th term for an order \(k\) explicit method to be stable.
Example 4.1
An explicit Runge-Kutta method is defined by the following Butcher tableau
Determine the stability function for this Runge-Kutta method and hence find its order.
Solution
Calculating \(\mathbf{b}^\mathsf{T}A^{k - 1}\mathbf{e}\) for \(k = 1, \ldots, 4\).
Therefore the stability function is
which agrees to the series expansion of \(e^z\) from equation (4.6) up to and including the \(z^2\) term. Therefore this method is of order 2.
4.2.2. Code#
The Python and MATLAB code used to determine the stability function for the ERK method from Example 4.1 is given below.
import sympy as sp
# Define ERK method
A = sp.Matrix([[0, 0, 0, 0],
[sp.Rational(1,2), 0, 0, 0],
[0, sp.Rational(3,4), 0, 0],
[sp.Rational(2,3), sp.Rational(1,3), sp.Rational(4,9), 0]])
b = sp.Matrix([sp.Rational(7,24), sp.Rational(1,4), sp.Rational(1,3), sp.Rational(1,8)])
e = sp.ones(4,1)
# Determine coefficients of the stability function
for k in range(4):
sp.pprint(b.T * A ** k * e)
% Define ERK method
A = [0, 0, 0, 0 ;
1/2, 0, 0, 0 ;
0, 3/4, 0, 0 ;
2/3, 1/3, 4/9, 0];
b = [7/24 ; 1/4 ; 1/3 ; 1/8];
e = ones(4, 1);
% Determine coefficients for the stability function
for k = 1 : 4
sym(b' * A ^ (k - 1) * e)
end