Numerical Solution of Ordinary Differential Equations

An initial-value problem asks for a function y(t)y(t) obeying y′(t)=f(t,y(t))y'(t)=f(t,y(t)) from a known start y(t0)=y0y(t_0)=y_0. Outside a handful of integrable cases no closed form exists, so physics does the next best thing: it lays down a grid tn=t0+nht_n=t_0+nh and manufactures approximations yn≈y(tn)y_n\approx y(t_n) by a recurrence that only ever evaluates the slope ff. Every solver you will ever meet — the RK4 buried in a game engine, the stiff BDF integrator inside a combustion code, the symplectic leapfrog that tracks the Solar System for a billion years — is a rule for turning slope samples into the next point. The craft is to squeeze the most accuracy out of each evaluation of ff while keeping two very different errors leashed: the discretization error you commit by replacing a derivative with a difference, and the round-off error the floating-point hardware sprinkles in. Two great families organize the whole subject. One-step Runge–Kutta methods build yn+1y_{n+1} from yny_n alone by sampling ff at several internal stages and averaging so that low-order Taylor terms cancel; they self-start and adapt easily. Linear multistep methods reuse a window of past values to reach high order with a single fresh evaluation per step — cheap, but haunted by parasitic modes. The theory that unifies them is one clean slogan: consistency plus zero-stability equals convergence, the discrete twin of the Lax equivalence theorem. And beyond convergence as h→0h\to0 sits the sharper practical question — does the error actually decay at the step you are using? — answered on the test equation y′=λyy'=\lambda y and made brutal by stiffness, where explicit methods choke and only implicit A-stable schemes survive.

Key takeaways
  • A solver replaces the continuous problem y′=f(t,y)y'=f(t,y), y(t0)=y0y(t_0)=y_0 with a discrete recurrence that marches the solution forward in steps of size hh.
  • Runge–Kutta methods reach high order inside a single step by sampling ff at intermediate stages; classical RK4 has local error O(h5)O(h^5) and global error O(h4)O(h^4).
  • Linear multistep methods (Adams–Bashforth/Moulton, BDF) reuse past values to reach high order cheaply, but are useful only when zero-stability (the root condition) and consistency both hold — together they give convergence.
  • Absolute stability — whether the error decays for y′=λyy'=\lambda y at finite hh — caps the step size; stiff problems force implicit, A-stable schemes such as backward Euler and BDF.
  • Embedded RK pairs (RK45) estimate the local error from two solutions of different order and adjust hh to hit a tolerance, spending small steps only where the solution is hard.
  • Dahlquist's barriers set the ceiling: no explicit linear multistep method is A-stable, and no A-stable linear multistep method has order above 2.
  • Key idea: every workable scheme balances three independent demands — order (how fast local error shrinks with hh), zero-stability (parasitic modes stay bounded as h→0h\to0), and absolute stability (error decays at the working step on y′=λyy'=\lambda y). Convergence needs the first two; efficiency on stiff problems needs the third.
The core insight

Every workable scheme balances three independent requirements: order (how fast the local truncation error shrinks with hh), zero-stability (parasitic modes stay bounded as h→0h\to0), and absolute stability (errors decay at the working step size on y′=λyy'=\lambda y). Convergence needs only the first two; efficiency on stiff problems needs the third.

Where this lives today

The theory laid down above runs, quietly, underneath a startling amount of modern science. Long-term Solar System integrations — establishing whether the planets are stable over billions of years, or steering a spacecraft through a gravity assist — use symplectic integrators such as the Wisdom–Holman map, because ordinary RK slowly leaks energy and would fake a spurious orbital decay over millions of revolutions, whereas the symplectic schemes conserve a shadow Hamiltonian and keep the energy error bounded forever. In combustion and atmospheric chemistry, reaction networks throw up eigenvalues spanning six or more orders of magnitude, and production codes such as SUNDIALS/CVODE lean on variable-order BDF with adaptive stepping and Newton iteration to integrate stiff kinetics with steps set by accuracy alone. In quantum mechanics the shooting method integrates the time-independent Schrödinger equation outward with a trial energy — often via Numerov's method, custom-built for ψ′′=g(x)ψ\psi''=g(x)\psi — and hunts the eigenvalue that satisfies the far boundary condition, realizing Bohr–Sommerfeld quantization numerically. And whenever an asymptotic or WKB expansion is checked, a high-accuracy numerical integration is the ground truth. The calls `solve_ivp` in SciPy, `ode45` in MATLAB, and DifferentialEquations.jl in Julia are the everyday face of eighty years of stability theory.

The physical picture

Think of integrating y′=fy'=f as walking a landscape whose local slope ff you can read at any point you stand. Euler's method is the most literal walker: it reads the slope where it is, commits to it, and takes one straight step of length hh. On a straight path that is exact; on a curved path the walker drifts off, and the drift accrues step after step. Runge–Kutta is a smarter walker who takes a tentative half-step, re-reads the slope there, and blends the readings so the straight step it finally commits to hugs the curve far more tightly. The first figure makes this drift quantitative: over the same interval and the same step size, Euler falls visibly short of the true exponential while RK4 sits on top of it.

Figure
Euler versus RK4 integrating y′ = y from y₀ = 1 over the interval 0 to 1 with step h = 0.25: the tangent-line Euler steps drift below the true curve eᵗ and reach only 2.441 at t = 1 (about 10 percent low), while RK4 lands on 2.718 to four figures
One step size, two walkers: Euler drifts below the curve, RK4 hugs it t y 0 1 true y = eᵗ Euler, h = 0.25 RK4 → 2.718 2.441 same 4 steps, same h — accuracy is the difference of order

Multistep methods are a different walker altogether: instead of probing forward, they fit a low-degree polynomial through the last few slope readings and integrate that polynomial one step ahead. This is thrifty — one new slope per step buys high order — but the fitting polynomial can support spurious oscillatory modes that have nothing to do with the true solution, and the root condition is exactly the demand that these parasites stay bounded. Stability, meanwhile, is the question of whether mistakes shrink or grow. On a decaying mode y′=λyy'=\lambda y with Re λ<0\mathrm{Re}\,\lambda<0 the true solution dies away, and a trustworthy solver must die away too; explicit methods only manage this inside a bounded patch of the complex plane z=hλz=h\lambda, so a very negative λ\lambda forces punishingly small hh. The second figure is the map of that patch — the region of absolute stability — and it carries the single inequality h≤2/∣λ∣h\le 2/|\lambda| that governs every explicit stiff calculation.

Figure
Regions of absolute stability in the complex plane z = hλ: forward Euler is stable only inside the disk where the amplification factor 1 + z has magnitude at most 1 (touching the origin and z = −2), so a decaying real mode needs h ≤ 2 over the modulus of λ, whereas the A-stable trapezoidal rule covers the entire left half-plane Re z ≤ 0
Where does the error decay? The stability region in the z = hλ plane Re z ≤ 0 trapezoidal rule stable here (A-stable) |1 + z| ≤ 1 forward Euler Re z Im z −2 0 RK4 reaches z ≈ −2.79 decaying real mode stable ⇔ h ≤ 2/|λ|

Adaptivity, finally, is feedback control laid over all of this. Run two estimates of the same step — a high-order and a low-order formula sharing the same stage evaluations — subtract them to read off the local error, and rescale hh to keep that error near a target tolerance. The solver then spends tiny steps only where the solution is genuinely hard and long steps where it coasts, which is why a modern integrator can cross fifteen orders of magnitude in timescale without human babysitting.

The core equations

The simplest possible rule sets the pattern for everything else: read the slope where you stand and step straight along it. This is forward Euler, the prototype explicit one-step method, obtained by truncating the Taylor expansion of the exact solution after the linear term.

yn+1=yn+h f(tn,yn)(1)y_{n+1}=y_n+h\,f(t_n,y_n) \qquad (1)

where: yny_n — the numerical approximation to y(tn)y(t_n); hh — the step size tn+1−tnt_{n+1}-t_n; f(t,y)f(t,y) — the right-hand side of y′=f(t,y)y'=f(t,y), evaluated at the current point. Reading: the new value is the old value plus one step of the current slope — cheap, explicit, and only first-order accurate. The same Taylor idea evaluated at the new point produces the implicit backward Euler rule; averaging the two endpoints gives the trapezoidal rule. Both put the unknown yn+1y_{n+1} on the right-hand side, so each step is an algebraic equation to be solved, and both buy something explicit methods cannot: unconditional stability on decaying modes.

yn+1=yn+h f(tn+1,yn+1),yn+1=yn+h2[f(tn,yn)+f(tn+1,yn+1)](2)y_{n+1}=y_n+h\,f(t_{n+1},y_{n+1}),\qquad y_{n+1}=y_n+\tfrac{h}{2}\bigl[f(t_n,y_n)+f(t_{n+1},y_{n+1})\bigr] \qquad (2)

where: the left formula is backward Euler (order 1); the right is the trapezoidal rule, also called Crank–Nicolson (order 2). Reading: because yn+1y_{n+1} appears inside ff, each step requires a root-find (Newton iteration for stiff systems) — the price of A-stability. To reach high order without leaving the one-step framework, Runge and Kutta sampled the slope at several internal stages and averaged them with weights chosen to cancel Taylor terms. The classical four-stage RK4 is the workhorse: two midpoint probes and one endpoint probe combined in a Simpson-like weighting.

k1=f(tn,yn)k2=f ⁣(tn+h2, yn+h2k1)k3=f ⁣(tn+h2, yn+h2k2)k4=f ⁣(tn+h, yn+h k3)yn+1=yn+h6(k1+2k2+2k3+k4)(3)\begin{aligned}k_1&=f(t_n,y_n)\\ k_2&=f\!\left(t_n+\tfrac{h}{2},\,y_n+\tfrac{h}{2}k_1\right)\\ k_3&=f\!\left(t_n+\tfrac{h}{2},\,y_n+\tfrac{h}{2}k_2\right)\\ k_4&=f\!\left(t_n+h,\,y_n+h\,k_3\right)\\ y_{n+1}&=y_n+\tfrac{h}{6}(k_1+2k_2+2k_3+k_4)\end{aligned} \qquad (3)

where: kik_i — the stage slopes sampling ff at internal points; h6(k1+2k2+2k3+k4)\tfrac{h}{6}(k_1+2k_2+2k_3+k_4) — the Simpson-weighted average of those slopes. Reading: four evaluations of ff per step buy local error O(h5)O(h^5) and global error O(h4)O(h^4) — the sweet spot for smooth nonstiff problems. Every RK method is one instance of a general ss-stage template encoded by a Butcher tableau. The coefficients are not free: matching the Taylor expansion of yn+1y_{n+1} to that of the exact solution imposes a growing thicket of algebraic order conditions, elegantly organized by Butcher's rooted trees.

yn+1=yn+h∑i=1sbiki,ki=f ⁣(tn+cih,  yn+h∑jaijkj)(4)y_{n+1}=y_n+h\sum_{i=1}^{s}b_i k_i,\qquad k_i=f\!\left(t_n+c_i h,\;y_n+h\sum_{j}a_{ij}k_j\right) \qquad (4)

where: aij,bi,cia_{ij},b_i,c_i — the Butcher-tableau coefficients that define the method; ss — the number of stages (function evaluations per step); βk=0\beta_k=0-style strictly-lower-triangular aija_{ij} make the method explicit. Reading: consistency demands ∑ibi=1\sum_i b_i=1, order 2 adds ∑ibici=12\sum_i b_i c_i=\tfrac12, and higher orders add tree conditions — RK4 satisfies eight of them. Multistep methods trade internal stages for memory: they combine several past values of yy and ff in a linear relation. The whole family is captured by two characteristic polynomials whose algebra decides consistency and zero-stability.

∑j=0kαj yn+j=h∑j=0kβj fn+j;ρ(ζ)=∑j=0kαjζj,σ(ζ)=∑j=0kβjζj(5)\sum_{j=0}^{k}\alpha_j\,y_{n+j}=h\sum_{j=0}^{k}\beta_j\,f_{n+j};\qquad \rho(\zeta)=\sum_{j=0}^{k}\alpha_j\zeta^{j},\quad \sigma(\zeta)=\sum_{j=0}^{k}\beta_j\zeta^{j} \qquad (5)

where: αj,βj\alpha_j,\beta_j — the method coefficients (βk=0\beta_k=0 explicit, βk≠0\beta_k\neq0 implicit); ρ(ζ)\rho(\zeta) — the first characteristic polynomial governing zero-stability; σ(ζ)\sigma(\zeta) — the second, entering consistency. Reading: consistency is the pair ρ(1)=0\rho(1)=0 and ρ′(1)=σ(1)\rho'(1)=\sigma(1); zero-stability is the root condition, that every root of ρ\rho lie in ∣ζ∣≤1|\zeta|\le1 with the unit-modulus roots simple. Whatever the method, its finite-hh behaviour is exposed by the linear test equation y′=λyy'=\lambda y, on which each scheme reduces to multiplication by a fixed amplification factor. The set of z=hλz=h\lambda for which errors do not grow is the region of absolute stability.

yn+1=R(z) yn  on  y′=λy, z=hλ;S={z∈C:∣R(z)∣≤1}(6)y_{n+1}=R(z)\,y_n\ \ \text{on}\ \ y'=\lambda y,\ z=h\lambda;\qquad S=\{z\in\mathbb{C}:|R(z)|\le1\} \qquad (6)

where: R(z)R(z) — the amplification factor per step; SS — the region of absolute stability; A-stability means S⊇{Re z≤0}S\supseteq\{\mathrm{Re}\,z\le0\}. Reading: forward Euler has R=1+zR=1+z (a disk), RK4 has R=1+z+z22+z36+z424R=1+z+\tfrac{z^2}{2}+\tfrac{z^3}{6}+\tfrac{z^4}{24}, and the trapezoidal rule has R=(1+z/2)/(1−z/2)R=(1+z/2)/(1-z/2), the only one covering the whole left half-plane.

Derivation ALocal and global error of forward Euler

The goal is to prove that forward Euler is genuinely first-order accurate, and to see precisely where the single power of hh is lost. We will show that although each individual step commits an error of size O(h2)O(h^2), the accumulation of those errors over the N=O(1/h)N=O(1/h) steps needed to cross a fixed interval degrades the guarantee to O(h)O(h) globally. The engine is a discrete Grönwall inequality: we write a recurrence for the error, bound it using the Lipschitz continuity of ff, and iterate to an exponential envelope hM2L(eL(tN−t0)−1)\tfrac{hM}{2L}(e^{L(t_N-t_0)}-1).

Step 1. Define the local truncation error as the residual left when the exact solution is fed through the scheme: τn=[y(tn+1)−y(tn)]/h−f(tn,y(tn))\tau_n=\bigl[y(t_{n+1})-y(t_n)\bigr]/h-f(t_n,y(t_n)). Taylor's theorem with Lagrange remainder gives y(tn+1)=y(tn)+h y′(tn)+12h2y′′(ξn)y(t_{n+1})=y(t_n)+h\,y'(t_n)+\tfrac12 h^2 y''(\xi_n), and since y′(tn)=f(tn,y(tn))y'(t_n)=f(t_n,y(t_n)) this collapses to τn=12h y′′(ξn)\tau_n=\tfrac12 h\,y''(\xi_n), so ∣τn∣≤12hM|\tau_n|\le\tfrac12 hM with M=max⁡∣y′′∣M=\max|y''|. Why: the truncation error is the exact solution's failure to satisfy the discrete rule, and Taylor's theorem measures that failure cleanly at one power of hh per lost derivative.

Step 2. Let en=y(tn)−yne_n=y(t_n)-y_n be the true global error. Subtract the scheme yn+1=yn+hf(tn,yn)y_{n+1}=y_n+hf(t_n,y_n) from the exact relation y(tn+1)=y(tn)+hf(tn,y(tn))+hτny(t_{n+1})=y(t_n)+hf(t_n,y(t_n))+h\tau_n to obtain en+1=en+h[f(tn,y(tn))−f(tn,yn)]+hτne_{n+1}=e_n+h\bigl[f(t_n,y(t_n))-f(t_n,y_n)\bigr]+h\tau_n. Why: differencing the exact and numerical marches isolates how last step's error propagates and how this step's fresh truncation error is injected.

Step 3. Use the Lipschitz condition ∣f(t,a)−f(t,b)∣≤L∣a−b∣|f(t,a)-f(t,b)|\le L|a-b| to bound the bracket, giving ∣en+1∣≤(1+hL)∣en∣+h∣τn∣|e_{n+1}|\le(1+hL)|e_n|+h|\tau_n|. Why: without a Lipschitz constant the error could amplify uncontrollably; with it, each step multiplies the standing error by at most 1+hL1+hL and adds a controlled injection.

Step 4. Iterate this linear recurrence from e0=0e_0=0 and use 1+hL≤ehL1+hL\le e^{hL} to sum the geometric series: ∣en∣≤max⁡∣τ∣L((1+hL)n−1)≤max⁡∣τ∣L(eLnh−1)|e_n|\le\dfrac{\max|\tau|}{L}\bigl((1+hL)^n-1\bigr)\le\dfrac{\max|\tau|}{L}\bigl(e^{Lnh}-1\bigr). Why: this is the discrete Grönwall lemma — the growth factor 1+hL1+hL raised to n=O(1/h)n=O(1/h) steps saturates to a finite exponential, so the error stays bounded on any fixed interval rather than blowing up.

Step 5. Substitute max⁡∣τ∣=12hM\max|\tau|=\tfrac12 hM to reach max⁡n∣y(tn)−yn∣≤hM2L(eL(tN−t0)−1)=O(h)\max_n|y(t_n)-y_n|\le\dfrac{hM}{2L}\bigl(e^{L(t_N-t_0)}-1\bigr)=O(h). The local order was two, the global order is one: exactly one power of hh is eaten by summing O(h2)O(h^2) errors over O(1/h)O(1/h) steps. Why: this one-power loss between local and global order is universal — a method with local error O(hp+1)O(h^{p+1}) has global error O(hp)O(h^p), which is why RK4's O(h5)O(h^5) step gives O(h4)O(h^4) globally. *Verified: standard textbook result (Arfken–Weber–Harris; Hairer–Nørsett–Wanner I) — Euler is order 1 with global error O(h)O(h); a single RK4 step on y′=yy'=y, h=0.1h=0.1 gives error 8.5×10−8≈h5/1208.5\times10^{-8}\approx h^5/120, confirming the local-order bookkeeping.*

Go deeper · Derivation B · 2 minStability functions and the A-stability of the trapezoidal rule
Derivation BStability functions and the A-stability of the trapezoidal rule

The goal is to make the abstract phrase "region of absolute stability" completely concrete by computing the amplification factor R(z)R(z) for two representative schemes and reading their stability regions straight off the algebra. We apply each method to the scalar test equation y′=λyy'=\lambda y, where the ODE has known decaying solutions whenever Re λ<0\mathrm{Re}\,\lambda<0, and demand that the numerical solution decay too. The payoff is the sharp contrast between the bounded disk of explicit Euler — the origin of the stiffness catastrophe — and the entire left half-plane covered by the implicit trapezoidal rule, the defining property of A-stability.

Step 1. Feed f=λyf=\lambda y into forward Euler: yn+1=yn+hλyn=(1+z)yny_{n+1}=y_n+h\lambda y_n=(1+z)y_n with z=hλz=h\lambda, so REuler(z)=1+zR_{\text{Euler}}(z)=1+z. The stability set ∣1+z∣≤1|1+z|\le1 is a disk of radius 1 centred at z=−1z=-1, touching the origin and the point z=−2z=-2. Why: the amplification factor is just the multiplier the scheme applies each step, and stability is nothing more than that multiplier having magnitude at most one.

Step 2. Specialize to a real decaying mode λ<0\lambda<0: the condition ∣1+hλ∣≤1|1+h\lambda|\le1 rearranges to h≤2/∣λ∣h\le 2/|\lambda|. A fast mode (large ∣λ∣|\lambda|) forces a tiny step purely for stability, even where the solution is smooth and accuracy would happily allow a large step — this single inequality is the stiffness problem in a nutshell. Why: the step ceiling is set by the fastest eigenvalue in the system, not by the feature you actually want to resolve, so wildly separated timescales cripple explicit methods.

Step 3. Now the trapezoidal rule: yn+1=yn+h2λ(yn+yn+1)y_{n+1}=y_n+\tfrac{h}{2}\lambda(y_n+y_{n+1}). Collect the yn+1y_{n+1} terms and solve for the ratio to get Rtrap(z)=1+z/21−z/2R_{\text{trap}}(z)=\dfrac{1+z/2}{1-z/2}. Why: implicitness means the new value is defined by an equation rather than a formula, but for the linear test problem that equation is trivial to solve, and the resulting rational amplification factor is the key to its superior stability.

Step 4. Test the magnitude: writing z=x+iyz=x+iy, one finds ∣1+z/2∣2−∣1−z/2∣2=2x|1+z/2|^2-|1-z/2|^2=2x, so ∣Rtrap(z)∣≤1|R_{\text{trap}}(z)|\le1 if and only if x=Re z≤0x=\mathrm{Re}\,z\le0. The entire left half-plane is stable, so no matter how stiff the mode, the trapezoidal step decays — the method is A-stable, and it is second-order accurate to boot. Why: covering all of Re z≤0\mathrm{Re}\,z\le0 decouples the step size from stability entirely, letting accuracy alone dictate hh — the property that makes implicit solvers indispensable for stiff systems. *Verified: Hairer & Wanner, Solving ODEs II — the trapezoidal rule (Crank–Nicolson) is A-stable and order 2; forward-Euler boundary z=−2z=-2 and the numeric stiff threshold h≤2/1000=0.002h\le2/1000=0.002 for y′=−1000yy'=-1000y both reproduced.*

Go deeper · Derivation C · 2 minThe Dahlquist equivalence theorem and the order barriers
Derivation CThe Dahlquist equivalence theorem and the order barriers

The goal is to state, and sketch the logic behind, the two theorems that turn numerical ODE solving from a bag of tricks into a rigorous subject. The first, the Dahlquist equivalence theorem, is the discrete analogue of the Lax equivalence theorem: for a linear multistep method, convergence holds if and only if the method is both consistent and zero-stable. The second pair, Dahlquist's order barriers, quantify exactly how much accuracy the stability requirement forbids you from buying — a convergent kk-step method cannot exceed order k+2k+2, and no A-stable multistep method can exceed order 2. Together they explain why practical codes settle on moderate-order Adams and BDF families rather than chasing ever-higher order.

Step 1. Write the order conditions as the linear constraints that make the difference operator annihilate polynomials 1,t,…,tp1,t,\dots,t^p: C0=∑jαj=0C_0=\sum_j\alpha_j=0 and Cq=∑j(jqq!αj−jq−1(q−1)!βj)=0C_q=\sum_j\bigl(\tfrac{j^q}{q!}\alpha_j-\tfrac{j^{q-1}}{(q-1)!}\beta_j\bigr)=0 for q=1,…,pq=1,\dots,p. The method has order pp exactly when C0=⋯=Cp=0C_0=\cdots=C_p=0 but Cp+1≠0C_{p+1}\neq0. Why: a method reproduces the true solution to order pp precisely when it integrates every polynomial up to degree pp exactly, and these residual coefficients measure the first failure.

Step 2. Recast consistency in the characteristic polynomials: C0=0C_0=0 is ρ(1)=0\rho(1)=0, and C1=0C_1=0 is ρ′(1)=σ(1)\rho'(1)=\sigma(1). Consistency (order at least 1) is therefore the pair of conditions on ρ\rho and σ\sigma met at ζ=1\zeta=1. Why: these two conditions say a constant and a linear ramp are integrated exactly — the minimum any method must do to even represent the differential equation as h→0h\to0.

Step 3. Impose zero-stability: every root of ρ(ζ)=∑jαjζj\rho(\zeta)=\sum_j\alpha_j\zeta^j must satisfy ∣ζ∣≤1|\zeta|\le1, with any root on the unit circle simple (the root condition). This forbids the parasitic solutions of the difference equation from growing, and it is exactly this constraint that caps how aggressively the αj\alpha_j can be tuned for high order. Why: a multistep recurrence has kk homogeneous modes; the physical one tracks the ODE while the rest are numerical artefacts, and only the root condition keeps those artefacts from swamping the answer.

Step 4. Combine. The equivalence theorem then reads: consistency + zero-stability ⇔\Leftrightarrow convergence, with global order equal to the consistency order pp. Dahlquist's first barrier sharpens the trade-off to p≤k+2p\le k+2 for symmetric even kk and p≤k+1p\le k+1 for odd kk; his second barrier states that A-stability forces p≤2p\le2, achieved optimally by the trapezoidal rule. Why: these are not engineering rules of thumb but proven ceilings — they tell you in advance that an A-stable multistep method of order 5 simply does not exist, so stiff high-order accuracy must come from BDF's A(α)-stability or from implicit Runge–Kutta instead. *Verified: Dahlquist (1956, 1963); stated in Hairer–Nørsett–Wanner I and Butcher (2016) — the equivalence theorem and both barriers are standard and sharp.*

Limiting cases

The right method is whichever one the regime rewards. The table reads off how the leading families behave as the problem changes character.

CaseResultMeaning
Smooth nonstiff problemglobal error ∼C hp\sim C\,h^pAccuracy dominates: explicit RK4 (p=4p=4) or high-order Adams methods are efficient, and the step is set by tolerance, not stability.
Stiff problem, ∣Re λ∣ h≫1|\mathrm{Re}\,\lambda|\,h\gg1y′=λy, Re λ≪0y'=\lambda y,\ \mathrm{Re}\,\lambda\ll0Explicit methods need h≲1/∣λ∣h\lesssim 1/|\lambda| merely to stay stable; switch to A-stable implicit schemes (backward Euler, BDF) whose step is set by accuracy alone.
Highly oscillatory / HamiltonianH(p,q)=12p2+V(q)H(p,q)=\tfrac12 p^2+V(q)Ordinary RK drifts in energy over long times; symplectic integrators (leapfrog, Störmer–Verlet) conserve a shadow Hamiltonian and bound the energy error.
Vanishing step h→0h\to0yn→y(tn)y_n\to y(t_n)Given consistency and zero-stability, convergence is guaranteed (Dahlquist), at rate O(hp)O(h^p) with pp the order.
Round-off floor, hh very smallerror ∼C1hp+C2 εmach/h\sim C_1 h^p + C_2\,\varepsilon_{\text{mach}}/hShrinking hh helps only until round-off, which grows as 1/h1/h, takes over; there is an optimal step, not an infinitely small one.

Worked examples

1 · RK4 versus Euler on a solvable benchmark (fully worked)

Integrate y′=yy'=y, y(0)=1y(0)=1 (exact solution y=ety=e^{t}) with a single step of size h=0.1h=0.1 using forward Euler and classical RK4. Compare each result to the exact value and to the predicted local truncation error.

Step 1. Exact target: y(0.1)=e0.1=1.10517092y(0.1)=e^{0.1}=\mathbf{1.10517092} (to eight figures). This is what both methods are trying to hit in one step.

Step 2. Forward Euler is one line: y1=y0+h f(t0,y0)=1+0.1⋅1=1.10000y_1=y_0+h\,f(t_0,y_0)=1+0.1\cdot1=\mathbf{1.10000}. The error is ∣1.10000−1.10517092∣=5.2×10−3|1.10000-1.10517092|=\mathbf{5.2\times10^{-3}}, and the predicted local truncation error is 12h2y′′(ξ)≈12(0.1)2e0=5.0×10−3\tfrac12 h^2 y''(\xi)\approx\tfrac12(0.1)^2 e^{0}=5.0\times10^{-3} — the two agree, confirming order 1.

Step 3. RK4 needs four slope evaluations. With f(t,y)=yf(t,y)=y: k1=1k_1=1; k2=1+0.12(1)=1.05k_2=1+\tfrac{0.1}{2}(1)=1.05; k3=1+0.12(1.05)=1.0525k_3=1+\tfrac{0.1}{2}(1.05)=1.0525; k4=1+0.1(1.0525)=1.10525k_4=1+0.1(1.0525)=1.10525.

Step 4. Combine with the Simpson weights: y1=1+0.16(1+2(1.05)+2(1.0525)+1.10525)=1+0.16(6.31025)=1.10517083y_1=1+\tfrac{0.1}{6}\bigl(1+2(1.05)+2(1.0525)+1.10525\bigr)=1+\tfrac{0.1}{6}(6.31025)=\mathbf{1.10517083}. The error is ∣1.10517083−1.10517092∣=8.5×10−8|1.10517083-1.10517092|=\mathbf{8.5\times10^{-8}}, matching the predicted local error h5/120=(0.1)5/120=8.3×10−8h^5/120=(0.1)^5/120=8.3\times10^{-8}.

Step 5. The verdict is stark: for four times the work per step, RK4 is roughly sixty thousand times more accurate (5.2×10−35.2\times10^{-3} versus 8.5×10−88.5\times10^{-8}) on this smooth problem. That ratio scales as h−3h^{-3}, so it only widens as the step shrinks — the reason RK4, not Euler, is the default one-step method. Euler error 5.2×10⁻³ (order 1), RK4 error 8.5×10⁻⁸ (order 4).

2 · The stiffness threshold for explicit Euler (fully worked)

A scalar mode obeys y′=−1000 yy'=-1000\,y, whose exact solution y=y0e−1000ty=y_0e^{-1000t} decays harmlessly. Integrate it with forward Euler. What is the largest stable step, and what happens just above it?

Step 1. The amplification factor is R(z)=1+zR(z)=1+z with z=hλ=−1000hz=h\lambda=-1000h. Stability requires ∣1+z∣≤1|1+z|\le1, i.e. ∣1−1000h∣≤1|1-1000h|\le1, which gives 0≤1000h≤20\le1000h\le2, so h≤0.002h\le\mathbf{0.002}.

Step 2. At the borderline h=0.002h=0.002: z=−2z=-2, R=−1R=-1, so ∣R∣=1|R|=1 — the numerical solution neither grows nor decays but flips sign each step, sitting exactly on the stability boundary.

Step 3. Just above, at h=0.0021h=0.0021: z=−2.1z=-2.1, R=1+(−2.1)=−1.1R=1+(-2.1)=-1.1, so ∣R∣=1.1>1|R|=1.1>1. The numerical solution now grows by 10 percent per step and alternates sign — after 100 steps it has been amplified by 1.1100≈1.4×1041.1^{100}\approx1.4\times10^{4}, exploding into oscillatory garbage while the true solution has decayed to e−0.21≈0.81e^{-0.21}\approx0.81.

Step 4. Note the scandal: accuracy would be perfectly happy with a far larger step, since the solution is smooth and nearly zero after t≳0.005t\gtrsim0.005. The tiny step is demanded only by stability. Switching to backward Euler removes the ceiling entirely — R=1/(1−z)=1/(1+1000h)R=1/(1-z)=1/(1+1000h) has magnitude below 1 for every h>0h>0, so any step is stable. Explicit Euler needs h ≤ 0.002; backward Euler is stable for all h. (For comparison, RK4's real-axis stability limit z≈−2.79z\approx-2.79 raises the explicit ceiling only to h≤0.00279h\le0.00279 — still ruinously small.)

Physics of the portrait

Numerical ODE solving looks like an engineer's toolkit, but a single figure turned it into a theory with proofs, ceilings, and an equivalence principle: Germund Dahlquist, who asked not "what works?" but "what is possible?".

Origins · 1 minGermund Dahlquist and how this was discovered
GD
Germund Dahlquist
1925–2005 · numerical analysis and the stability theory of difference methods

Germund Dahlquist was a Swedish mathematician who, almost single-handedly in the mid-1950s, gave the numerical solution of differential equations its theoretical backbone. Before him, multistep formulae were a catalogue of recipes — Adams', Moulton's, Milne's — each with empirically known virtues and vices. Dahlquist's 1956 paper proved the equivalence theorem that now bears his name: a linear multistep method converges if and only if it is consistent and zero-stable, the discrete counterpart of the Lax–Richtmyer theorem for PDEs. He introduced the root condition, the first and second characteristic polynomials, and the very notion of zero-stability, turning a fog of special cases into a clean dichotomy. Then he proved the barriers that made the subject quantitative: the first caps a convergent kk-step method's order at k+2k+2, and the second — his most cited result, from 1963 — shows that no A-stable linear multistep method can exceed order 2, with the trapezoidal rule optimal. The word "stiff" was not his (Curtiss and Hirschfelder coined it in 1952), but the mathematics that tamed stiffness grew directly from his framework. Dahlquist founded the numerical analysis group at Sweden's KTH, co-wrote with Åke Björck the textbook that trained generations, and left a discipline where you can prove, before writing a line of code, exactly what a method can and cannot do.

History
1768
— Euler introduces the polygonal tangent-line method in Institutionum calculi integralis
1895
— Runge launches one-step methods built from averaged slope samples
1901
— Kutta classifies the fourth-order schemes, including classical RK4
1956
— Dahlquist proves consistency plus zero-stability equals convergence
1963
— Dahlquist's second barrier caps A-stable multistep order at two

Going further

Texts. Stone & Goldbart, Mathematics for Physics (2009), chapter on numerical methods · Arfken, Weber & Harris, Mathematical Methods for Physicists, 7th ed., section on numerical integration of ODEs · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, 3rd ed., ch. 27 · Hairer, Nørsett & Wanner, Solving ODEs I (Nonstiff Problems), Springer 1993 · Hairer & Wanner, Solving ODEs II (Stiff and DAE Problems), Springer 1996 · Butcher, Numerical Methods for Ordinary Differential Equations, 3rd ed., Wiley 2016 · Dahlquist & Björck, Numerical Methods in Scientific Computing, SIAM 2008.

Provenance. Equations, orders, and barriers verified against Hairer–Nørsett–Wanner (Solving ODEs I & II), Butcher (2016), Arfken–Weber–Harris, and Dahlquist's original 1956/1963 papers. A verifier should recompute: (1) Euler local truncation 12h2y′′\tfrac12 h^2 y'' and global O(h)O(h) via discrete Grönwall; (2) the single-step RK4 result on y′=yy'=y, h=0.1h=0.1 giving error 8.5×10−8≈h5/1208.5\times10^{-8}\approx h^5/120; (3) the stability functions REuler=1+zR_{\text{Euler}}=1+z, Rtrap=(1+z/2)/(1−z/2)R_{\text{trap}}=(1+z/2)/(1-z/2) and trapezoidal A-stability; (4) the stiff threshold h≤2/∣λ∣=0.002h\le2/|\lambda|=0.002 for y′=−1000yy'=-1000y and the RK4 real-axis limit z≈−2.785z\approx-2.785; (5) AB2 coefficients h2(3fn+1−fn)\tfrac{h}{2}(3f_{n+1}-f_n); (6) Dahlquist's first and second barriers. All numbers are standard.

Prerequisites. Taylor's theorem and remainder estimates · Linear constant-coefficient difference equations · Eigenvalues and matrix exponentials · Order Symbols and Gauge Functions. Leads to. WKB Approximation · Asymptotic Series and Poincaré Expansions · Bohr–Sommerfeld Quantization.

Ask the tutor: Ask me to hand-run RK4 or backward Euler on your own ODE, or to sketch why your explicit solver blows up and which implicit or symplectic method would fix it.

What is the difference between local and global error, and why does one power of h vanish between them?

The local truncation error is the mistake a method makes in a single step, assuming it started that step from the exact solution. The global error is the mistake actually accumulated over the whole integration. For a method of order pp the local error is O(hp+1)O(h^{p+1}), but crossing a fixed interval [t0,tN][t_0,t_N] takes N=(tN−t0)/h=O(1/h)N=(t_N-t_0)/h=O(1/h) steps, and the errors compound. Summing O(1/h)O(1/h) contributions of size O(hp+1)O(h^{p+1}) gives O(hp)O(h^p) — exactly one power of hh is lost. So forward Euler's O(h2)O(h^2) step becomes O(h)O(h) globally, and RK4's O(h5)O(h^5) step becomes O(h4)O(h^4). The Grönwall argument shows the compounding stays bounded (an exponential in the interval length, not a blow-up) as long as ff is Lipschitz.

What actually makes a problem "stiff"?

Stiffness is not about the equation being hard to write down — it is about a mismatch of timescales. A system is stiff when it contains modes that decay far faster than the timescale you care about resolving, so that after a brief transient the fast modes are dead and the solution is smooth, yet an explicit method is still forced to take absurdly small steps just to keep those already-decayed modes stable. The signature is a Jacobian with eigenvalues whose real parts span many orders of magnitude, all negative. The practical test: if reducing the step size is required for stability rather than accuracy — if your smooth-looking solution suddenly explodes into oscillation when you lengthen the step — you are stiff, and you should switch to an implicit A-stable or A(α\alpha)-stable solver (backward Euler, trapezoidal, BDF) rather than shrink the step.

Why bother with implicit methods when solving an equation each step is so expensive?

Because on a stiff problem the alternative is catastrophically worse. An explicit method's step is capped by the fastest mode: if your system has an eigenvalue λ=−106\lambda=-10^6, explicit Euler needs h≲2×10−6h\lesssim2\times10^{-6}, so integrating to t=1t=1 takes half a million steps even though the interesting dynamics are perfectly smooth. An implicit A-stable method has no such ceiling — its step is limited only by the accuracy you want, perhaps a few thousand steps for the same problem. Yes, each implicit step costs a Newton iteration and a linear solve, but trading a handful of linear solves per step for a thousand-fold reduction in the number of steps is overwhelmingly worth it. The cross-over is exactly stiffness: for nonstiff problems explicit RK wins; for stiff ones implicit methods win by orders of magnitude.

Is a higher-order method always better?

No — order describes the asymptotic regime h→0h\to0, and you may not be in it. A high-order method carries a larger error constant and a more restrictive stability region, so its advantage only materializes once hh is small enough that the hph^p scaling dominates. On a problem with limited smoothness (discontinuous forcing, non-smooth ff) the extra derivatives the order relies on do not exist, and the method degrades to low order anyway. High order is also wasted below the accuracy you need, and every method eventually hits the round-off floor, where error grows like εmach/h\varepsilon_{\text{mach}}/h and shrinking hh makes things worse. Match the order to the smoothness of the problem and the accuracy demanded, rather than maximizing it blindly.

What are symplectic integrators, and when do I need one?

Symplectic integrators are methods built for Hamiltonian systems — orbital mechanics, molecular dynamics, any q˙=∂H/∂p\dot q=\partial H/\partial p, p˙=−∂H/∂q\dot p=-\partial H/\partial q. Their defining property is that they exactly preserve the geometric structure of phase space (the symplectic two-form), so they do not conserve the true energy HH but do conserve a nearby "shadow" Hamiltonian to all orders in hh. The consequence is spectacular: over a long run an ordinary RK method lets the energy drift steadily, faking orbital decay, whereas a symplectic method (leapfrog, Störmer–Verlet, Wisdom–Holman) keeps the energy error bounded and merely oscillating forever. You need one whenever qualitative long-time behaviour matters more than pointwise accuracy — tracking the Solar System over gigayears, or running billions of molecular-dynamics steps. For a short, accurate trajectory, ordinary RK is fine.

How does an adaptive solver decide the step size automatically?

It runs error estimation as feedback control. An embedded Runge–Kutta pair (Fehlberg's RK45, Dormand–Prince) computes two approximations of different order from the same stage evaluations, so their difference is essentially free and estimates the local error ε\varepsilon of the current step. The controller compares ε\varepsilon to a user tolerance and rescales the step by roughly (tol/ε)1/(p+1)(\text{tol}/\varepsilon)^{1/(p+1)}: if the estimated error is too big the step is rejected and retried smaller, if it is comfortably small the next step grows. The result is that the solver automatically takes tiny steps through sharp features and long steps through smooth stretches, delivering a requested accuracy at close to minimal cost — and it is why you can hand `solve_ivp` a problem spanning many timescales and simply trust the answer without hand-tuning hh.

Before this

Where this leads