Multistep Methods
Runge-Kutta methods throw away all information from previous steps. Multistep methods reuse it: they combine the solution or slope values at several past time points, so each new step needs only one new evaluation of , whatever the order. The Adams and BDF families built this way are the engines of many production ODE solvers.
Adams-Bashforth (explicit)
Integrate from to and replace by the polynomial interpolating the last slope values (Polynomial Interpolation):
| Method | Formula | Order |
|---|---|---|
| AB1 | (Euler) | 1 |
| AB2 | 2 | |
| AB3 | 3 | |
| AB4 | 4 |
Adams-Moulton (implicit)
Including the unknown new slope in the interpolation gives more accurate, more stable implicit formulas, for example the trapezoid rule (AM2). Implicit equations are solved by iteration, often with an Adams-Bashforth predictor and one Adams-Moulton corrector step (a predictor-corrector pair).
Starting values
A -step method needs starting values, but the IVP supplies only . The others come from a one-step method of the same order (for example RK4 for AB4).
import numpy as np
def ab4(f, a, b, u0, n):
h = (b - a) / n
t = a + h * np.arange(n + 1)
u = np.zeros(n + 1); u[0] = u0
F = np.zeros(n + 1)
for i in range(3): # RK4 starter
k1 = f(t[i], u[i]); k2 = f(t[i] + h/2, u[i] + h/2*k1)
k3 = f(t[i] + h/2, u[i] + h/2*k2); k4 = f(t[i] + h, u[i] + h*k3)
u[i + 1] = u[i] + h/6 * (k1 + 2*k2 + 2*k3 + k4)
for i in range(4):
F[i] = f(t[i], u[i])
for i in range(3, n):
u[i + 1] = u[i] + h / 24 * (55*F[i] - 59*F[i-1] + 37*F[i-2] - 9*F[i-3])
F[i + 1] = f(t[i + 1], u[i + 1]) # one new evaluation per step
return u[-1]
f = lambda t, u: -2 * t * u
exact = np.exp(-4.0)
prev = None
for n in (40, 80, 160, 320):
err = abs(ab4(f, 0, 2, 1.0, n) - exact)
print(f"n = {n:3d}: error {err:.3e}" + ("" if prev is None else f", ratio {prev / err:.1f}"))
prev = errn = 40: error 3.038e-06
n = 80: error 1.680e-07, ratio 18.1
n = 160: error 9.821e-09, ratio 17.1
n = 320: error 5.926e-10, ratio 16.6
Fourth order (ratios approach 16) at one evaluation per step, a quarter of RK4's cost.
Stability: zero-stability and absolute stability
A multistep method is a linear recurrence with several solutions, only one of which approximates the ODE. The others are parasitic and must not grow:
- Zero-stability (the roots of the characteristic polynomial lie in the unit disk, simple on its boundary) is necessary for convergence at all. Dahlquist's theorem: consistent + zero-stable = convergent.
- Absolute stability regions of Adams-Bashforth methods are small and shrink as the order grows (AB4 is stable on the negative axis only for ), so they are poor for stiff problems.
import numpy as np
def ab2_test(hl, n=200):
u_prev, u = 1.0, 1.0 + hl # start with one Euler step
for _ in range(n):
u_prev, u = u, u + hl / 2 * (3 * u - u_prev)
return abs(u)
for hl in (-0.5, -0.9, -1.1):
print(f"h*lambda = {hl}: |u_200| = {ab2_test(hl):.2e}")h*lambda = -0.5: |u_200| = 1.08e-39
h*lambda = -0.9: |u_200| = 1.41e-13
h*lambda = -1.1: |u_200| = 3.88e+10
AB2 is stable for real , half of Euler's interval.
BDF methods
Backward differentiation formulas interpolate the solution values (not the slopes) and set the derivative of the interpolant at equal to . BDF1 is backward Euler; BDF2 is . BDF1 to BDF6 have large stability regions containing the whole negative real axis, which makes them the standard choice for stiff problems (Stiff Equations).
In software
solve_ivp(method="BDF")(variable order 1 to 5),"LSODA"(switches automatically between Adams for non-stiff and BDF for stiff phases).- CVODE (SUNDIALS) implements variable-order, variable-step Adams and BDF methods and is used inside many simulation packages.
Exercises
Exercise 1: Derive AB2
Integrate the line through and from to .
Answer
.
Solution
The line is ; integrating over gives .
Exercise 2: Cost per step
How many evaluations of do AB4 and RK4 need per step?
Answer
AB4: 1; RK4: 4.
Solution
AB4 reuses the stored slopes. The price is the starting procedure and a smaller stability region.
Exercise 3: A zero-unstable method (code)
The explicit two-step method is third-order consistent but not zero-stable (characteristic root ). Apply it to with exact starting values and for 30 steps.
Answer
The solution explodes to astronomically large values, although the exact answer is about .
Solution
import numpy as np
h = 0.01
u_prev, u = 1.0, np.exp(-h)
for i in range(1, 30):
u_prev, u = u, -4 * u + 5 * u_prev + h * (4 * (-u) + 2 * (-u_prev))
print(f"u(0.3) computed {u:.3e}, exact {np.exp(-0.3):.4f}")u(0.3) computed -5.086e+10, exact 0.7408
Rounding errors excite the parasitic solution , which grows by a factor of about 5 per step.
Test yourself
Adams-Bashforth methods need how many new function evaluations per step?
- one
- as many as the order
- two
- none
A -step method needs starting values from…
- nowhere
- a one-step method such as Runge-Kutta
- the user only
- the final value
Which family is the standard choice for stiff problems?
- Adams-Bashforth
- BDF
- explicit Euler
- RK4