School/✦ Research Engineer/Week 7
Stability regions and stiffness
The fast part of your model died out in a millisecond, yet your simulation still crawls along in microsecond steps. Why?
About 45 min · 3 goals · Checked by automated tests
1.Why should I care?
Circuits with tiny parasitic capacitances, chemical reactions, thermal models with thin layers: real models often mix very fast and very slow dynamics. Explicit methods then need tiny steps for stability, not accuracy, and become absurdly slow.
- ◇ Apply a method to the test equation y′ = λy and find its amplification factor R(hλ).
- ◇ Compute the largest stable explicit Euler step, h ≤ 2/|λ| for real negative λ.
- ◇ Recognise stiffness and explain why implicit methods are used for stiff problems.
2.Predict
Explicit Euler on y′ = −1000y with h = 0.003. The exact solution decays to zero almost instantly. What does Euler do?
Guess first. Being wrong here is how the surprise works.
3.Discover
Switch to 'Stiffness test y′ = λy'. Slide z = hλ from −0.5 towards −3.5. Note where Euler starts oscillating, where it blows up, and where RK4 finally fails too.
Loading the interactive…
Can't use the interactive? Read a description instead
In stiffness mode the diagram plots twenty steps of the numerical solution of y′ = λy for Euler and RK4 at a chosen z = hλ. Text gives each method's amplification factor and says when Euler blows up although the exact solution decays.
4.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1 · a fresh version every time
Explicit Euler is applied to dy/dt = −50y. What is the largest step h for which the numerical solution does not grow (|1 + hλ| ≤ 1)?
5.Understand
Stability regions
For a system x′ = Ax, each eigenvalue λ of A gives a test equation. An explicit method is stable only if hλ lies inside its stability region for every eigenvalue. So the fastest-decaying mode (largest |λ|) sets the maximum step, even if that mode is physically irrelevant after a moment.
What stiffness means
A problem is stiff when it has decaying modes on very different time scales, and you want to follow the slow one. Example: eigenvalues −1 and −1000. Accuracy for the slow mode would allow h ≈ 0.1, but explicit Euler stability needs h ≤ 0.002: fifty times more steps, purely to avoid blowing up.
The remedy
Implicit methods (backward Euler, the trapezoidal rule, BDF methods) solve an equation each step, often a linear system with (I − hA) via LU from week 2, but stay stable with large steps. Library solvers flagged for stiff problems (such as 'BDF' or 'Radau' options) do this automatically.
Explain it another way
A stiff problem is a convoy with a hyperactive scout and a slow lorry. Explicit methods must pace themselves to the scout, long after the scout has stopped.
Stiffness ratio = max|Re λ| / min|Re λ| over the decaying modes. Ratios of 10³ to 10⁶ are common in circuit and chemistry models.
A power-electronics simulation with a 1 µs switching transient and a 1 s thermal response is stiff; stiff solvers are the default in circuit simulators for this reason.
Derivation: Amplification factors and stability limits
Test equation: y′ = λy, exact yₙ₊₁ = e^{hλ}yₙ. Let z = hλ.
Explicit Euler: yₙ₊₁ = yₙ + hλyₙ = (1 + z)yₙ, so R(z) = 1 + z.
Stable (no growth) iff |1 + z| ≤ 1. For real λ < 0: −2 ≤ z ≤ 0, so h ≤ 2/|λ|.
RK4 on the test equation gives R(z) = 1 + z + z²/2 + z³/6 + z⁴/24 (the Taylor series of e^z to z⁴). On the negative real axis |R| ≤ 1 for z ≥ about −2.79.
Implicit (backward) Euler: yₙ₊₁ = yₙ + hλyₙ₊₁, so R(z) = 1/(1 − z), with |R| < 1 for every z < 0: stable for any step on decaying problems.
Worked example 1
x′ = Ax with eigenvalues −2 and −500. Largest stable explicit Euler step?
Need h ≤ 2/|λ| for both: 2/2 = 1 and 2/500 = 0.004. The binding one is h ≤ 0.004.
Common mix-ups
- Instability means the physical system is unstable.
✓ Numerical instability can occur for a perfectly stable physical system if h is too large for the method. - Higher-order explicit methods cure stiffness.
✓ RK4's real stability limit is only about z ≥ −2.79; stiffness needs implicit methods.
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
Explicit Euler is applied to dy/dt = −5y. What is the largest step h for which the numerical solution does not grow (|1 + hλ| ≤ 1)?
Practice 3
Euler on y′ = −50y with h = 0.05. What is R = 1 + hλ?
Practice 4
Which system is stiff (if we care about the slow behaviour)?
Practice 5
Why can backward Euler take large steps on y′ = −1000y?
Practice 6 · a fresh version every time
For dy/dt = 1y with y(0) = 2, take one classical RK4 step with h = 0.5. What is y₁? (4 decimal places.)
7.Apply it
Simulate y′ = −1000(y − cos t), y(0) = 0, to t = 2 with explicit Euler (h = 0.0019 and 0.0021) and backward Euler (h = 0.05; solve the linear update by hand). Plot all three and explain the difference in one paragraph.
8.Reflect
Concepts: Numerical integration of ODEs: Euler, RK4 and stiffness · Eigenvalues and the stability of dynamic systems