A method with small truncation error can still produce garbage if the step is too big, even when the true solution is perfectly calm. To see why, apply it to the test equation $$y' = \lambda y,\qquad \text{Re}\,\lambda < 0,$$ whose solution $y_0e^{\lambda t}$ decays. This is the ODE version of algorithm stability.
Euler's method gives $y_{n+1} = y_n + h\lambda y_n = (1 + h\lambda)y_n$, so $$y_n = (1 + h\lambda)^{n}y_0.$$ Every one-step method turns into $y_{n+1} = R(h\lambda)\,y_n$ for some function $R$, its amplification factor.
Key idea
Why it works
Worked example: Too big a step
- $h = 0.25$: $R = 1 - 2.5 = -1.5$, so $y_n = (-1.5)^{n}$: $1, -1.5, 2.25, -3.375, \ldots$ It grows and flips sign.
- $h = 0.15$: $R = -0.5$: the values decay, with a wrong-signed wiggle.
- $h = 0.05$: $R = 0.5$: smooth decay, as $e^{-10t}$ does. The limit is $h = \frac{2}{10} = 0.2$.
Answer: blows up for $h > 0.2$
Worked example: A stiff system
- $\lambda = -1$ needs $h \le 2$; $\lambda = -1000$ needs $h \le 0.002$.
- So $h \le 0.002$, a thousand times smaller than accuracy for the slow part would require, even after the fast part has died away. Such a system is stiff.
Answer: $h \le 0.002$
Worked example: A complex eigenvalue
- $|1 + h\lambda|^{2} = (1 - h)^{2} + 9h^{2} \le 1$ gives $10h^{2} - 2h \le 0$.
- So $h \le \frac{2}{10} = 0.2$. In general $h \le \frac{2|\text{Re}\,\lambda|}{|\lambda|^{2}}$; for nearly undamped oscillations this gets tiny.
Answer: $h \le 0.2$
| method | $R(z)$ | stable on the negative real axis for |
|---|---|---|
| forward Euler | $1 + z$ | $-2 \le z \le 0$ |
| Heun | $1 + z + \frac{z^{2}}{2}$ | $-2 \le z \le 0$ |
| RK4 | $1 + z + \cdots + \frac{z^{4}}{24}$ | about $-2.79 \le z \le 0$ |
| backward Euler | $\frac{1}{1 - z}$ | all $z \le 0$ |
Common mistake