4.2. Stability Functions#
To study the stability properties of a numerical method we consider how it propagates small error from one step to the next. A convenient model problem for this purpose of the linear test equation
where \(\lambda \in \mathbb{C}\) is a constant. This equation is simple enough to analyse exactly, having solution
yet it captures the essential growth or decay behaviour that numerical methods must reproduce.
Suppose a numerical mtehod is applied to this test equation. Since the method advances the numerical solution from \(y_n\) to \(y_{n+1}\), any perturbation or error is propagated by exactly the same update formula. The resulting factor by which the solution (and hence the error) is multiplied in one step is called the stability function.
Definition 4.2 (Stability function)
The stability function of a method, denoted by \(R(z)\), is the rate of growth over a single step of the method when applied to calculate the solution of an ODE of the form \(y'=\lambda t\) where \(z = h \lambda\) and \(h\) is the step size
For example, if the Euler method is used to solve the test equation \(y'=\lambda y\) then the solution will be updated over one step using
Let \(z = h\lambda\) then
So the stability function of the Euler method is \(R(z) = 1 + z\).
4.2.1. Stability function of a Runge-Kutta method#
The general form of a Runge-Kutta method is
Let \(Y_i = y_n + h \displaystyle \sum_{j=1}^s a_{ij} k_j\) 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)^\mathsf{T}\) and \(\mathbf{e}=(1,1,\dots ,1)^\mathsf{T}\) 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
Rearranging equation (4.3) gives
Substituting into equation (4.4)
so the stability function is
This formula is valid for any Runge-Kutta method.
Definition 4.3 (Stability function for a general Runge-Kutta method)
4.2.2. Stability function of an explicit Runge-Kutta method#
Equation (4.5) provides the stability function for a general Runge-Kutta method. For explicit Runge-Kutta methods, we can represent the inverse matrix \((I - zA)^{-1}\) as a power series summation.
The Neumann series for matrices is
so
Since for an explicit method, the matrix \(A\) is strictly lower triangular then
and
Substituting into equation (4.5)
which is the stability function for an ERK method.
Definition 4.4 (Stability function of an explicit Runge-Kutta method)
So the stability function of an \(s\)-stage explicit method is a polynomial function of at most degree \(s\)
The exact solution satisfies
therefore, for an order \(p\) method, the stability function should approximate \(e^z\) with an error of \(O(z^{p+1})\) as \(z \to 0\). The series expansion of \(e^z\) is
Comparing the coefficients of \(z^k\) in equations (4.6) and (4.7) we have
These are necessary conditions for an ERK method to have order \(k\). For general Runge-Kutta methods additional order conditions are also required.
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, 3\).
therefore the stability function is
which agrees to the series expansion of \(e^z\) from equation (4.7) up to and including the \(z^2\) term showing that the method has linear order 2.
4.2.3. 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,9), sp.Rational(1,3), sp.Rational(2,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/9, 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