MTH3007b Lecture 4
Me, in the lecture
zzzzz…
Lecture 3 derived the family of second-order RK schemes, presented RK4, and introduced symmetric methods including the implicit trapezoid. This session makes the notion of Stability of an ODE precise - for both the ODE and the numerical method - then applies these ideas to evaluate the methods seen so far. We also extend all explicit RK methods to Systems of ODEs and implement a predator-prey model.
Stability of an ODE
Definition
An ODE is stable at a solution if small perturbations to the initial condition remain small for all future time. Formally: for any there exists such that if then for all .
Example
is unstable: perturbations grow like , so any small initial error eventually becomes large.
Example
() is stable: perturbations decay like , so the solution is insensitive to small changes in initial conditions.
Stability of a Numerical Method
Definition
A numerical method is stable for a given ODE if, for a stable ODE, the numerical solution remains bounded for all time (i.e., the numerical difference between two solutions with slightly different initial conditions stays bounded).
Warning
A method can be stable for small and unstable for large - this is conditional stability. A method that is stable for all is unconditionally stable.
Stability Analysis: Test Equation
The standard test equation for stability analysis is with .
Explicit (Forward) Euler
The update is . After steps:
The amplification factor is . This must satisfy for stability, which requires
Warning
Explicit Euler is conditionally stable on : unstable when .
Implicit (Backward) Euler
The update is . The amplification factor is .
Since and , we always have .
Important
Implicit Euler is unconditionally stable for : the amplification factor is always strictly less than 1.
Explicit RK Methods
All explicit RK methods (midpoint, Ralston, RK4) are conditionally stable - they have a finite stability region in the plane. The stability region is larger for higher-order methods (RK4’s stability region extends to ), but conditional stability remains.
Convergence and the Lax Equivalence Theorem
Convergence means the numerical solution approaches the exact solution as .
Consistency means the local truncation error per step satisfies as (i.e., the scheme is at least first-order).
Important
Lax Equivalence Theorem: for a consistent, linear numerical scheme, stability is equivalent to convergence. In short: consistent + stable convergent.
This formalises the practical observation that methods which do not blow up (stable) and which correctly approximate the derivative (consistent) will converge to the right answer.
Richardson Method
The Richardson method (also called the leap-frog or central-difference method) uses a symmetric two-step formula:
This is a symmetric method (time-reversible), which is appealing. However:
Warning
The Richardson method is unconditionally unstable for . Despite being symmetric and consistent, it has a parasitic growing mode that cannot be suppressed for any choice of . It is not used in practice.
This is a cautionary example: symmetry does not guarantee stability.
Systems of ODEs
Generalisation
All the single-equation methods generalise directly to Systems of ODEs by replacing the scalar with a vector and with a vector-valued function .
For explicit Euler:
For RK4, the same four-stage formula applies with all being vectors.
Predator-Prey (Lotka-Volterra) Model
The Lotka-Volterra equations model interacting prey () and predator () populations:
where are parameters. The nonlinear coupling terms and represent predation.
Note
The state vector
state_arrayhas shape(number_of_equations, number_of_steps+1). The functiongreturns a NumPy array, so the slicestate_array[:,step_index]picks out the full state at step . This vectorised structure works equally for any explicit RK method by replacing the update line.
Pre-Lecture Notes from University Notes
- ODE stability (epsilon-delta): stable if small perturbations to IC stay small; unstable, stable
- Method stability: numerical solution bounded for all time on a stable ODE
- Test equation : explicit Euler amplification factor , stable iff (conditional); implicit Euler factor always (unconditional)
- Explicit RK methods all conditionally stable; stability region grows with order
- Lax equivalence theorem: consistent + stable convergent
- Richardson method: - symmetric but unconditionally unstable for
- Systems of ODEs: replace scalar with vector ; same update formulas apply component-wise
- Lotka-Volterra example: two coupled nonlinear ODEs for prey/predator populations, implemented with explicit Euler and vector
- Next session: numerical integration via ODEs, reduction of higher-order ODEs, and introduction to PDEs