Introduction to Numerical Methods
Most problems in physics cannot be solved in closed form. A nonlinear differential equation, a transcendental eigenvalue condition, a definite integral with no elementary antiderivative — each resists analytic attack, yet each demands a number. Numerical methods are the systematic answer: they recast the intractable problem so its solution emerges from a finite sequence of additions, subtractions, multiplications, and divisions — the only operations a computer truly performs. The art is to design that finite arithmetic so its output is provably close to the exact, unknowable answer, and to know how close. Two errors are unavoidable and conceptually independent. Truncation error is the price of approximating a continuous or infinite process by a finite one: a derivative becomes a difference quotient, an integral a weighted sum, an infinite series a cut-off partial sum. Round-off error is the price of storing real numbers in finite precision — IEEE 754 double precision keeps about sixteen decimal digits and no more. The two pull in opposite directions: shrinking the step size shrinks the truncation term but sharpens the differences that amplify round-off, so the best is a compromise, not a limit. Beyond accuracy sits stability — whether errors, once seeded, grow or decay as a calculation iterates. A method can be formally accurate yet catastrophically unstable, its round-off swelling exponentially until it swamps the truth. And beneath the algorithm sits conditioning, a property of the problem itself: an ill-conditioned problem magnifies any input perturbation, so even flawless arithmetic returns a poor answer. This article assembles the vocabulary — order symbols, error budgets, machine epsilon, stability, conditioning, cost — that underlies the whole subject, from root-finding and quadrature to differential equations, and reappears in continuous guise throughout asymptotics.
- Numerical methods replace exact analytic operations — limits, derivatives, integrals, root-finding — with finite sequences of floating-point arithmetic a computer can execute.
- Every result carries two independent errors: truncation error from discretizing the continuous problem, and round-off error from finite-precision arithmetic ().
- The two errors trade off: total error has a minimum at a finite optimal step , so smaller is not always better.
- A method's order of accuracy sets the payoff of refinement: halving shrinks truncation error by — a factor 4 for trapezoid-like , 16 for Simpson-like .
- Stability is often more decisive than accuracy: forward Euler on diverges unless , however small the formal error.
- Conditioning belongs to the problem, not the solver: the condition number bounds how badly a linear system amplifies input error, no matter how clever the algorithm.
- Key idea: a numerical method trades the unsolvable continuous problem for a finite-arithmetic surrogate; success means controlling the gap (truncation error), the arithmetic noise (round-off), and the growth of both (stability) at once, while keeping the operation count affordable.
A numerical method trades the unsolvable continuous problem for a finite-arithmetic surrogate; success means controlling the gap (truncation error), the arithmetic noise (round-off), and the growth of both (stability) all at once, while keeping the operation count affordable.
Where this lives today
The vocabulary of this article is the daily currency of computational physics. In molecular dynamics and celestial mechanics, symplectic integrators such as velocity-Verlet and leapfrog beat generic Runge–Kutta schemes because they bound the energy error over billions of steps — a stability property, not an accuracy one, that lets a protein or a planetary system run for astronomical times without drift. In lattice QCD and many-body physics, bound-state energies come from a matrix eigenvalue problem whose conditioning sets how many digits survive, benchmarked against WKB and Bohr–Sommerfeld asymptotics. High-dimensional integrals fall to Monte Carlo, whose error is dimension-independent. And every finite-element or finite-difference solver lands on a linear system whose condition number dictates accuracy; the whole industry of preconditioning exists to reshape toward so the iterative solvers behind exascale simulations converge at all. The CFL condition still sets the time step of every explicit weather and astrophysics code on Earth.
The physical picture
Think of a numerical method as photographing a smooth curve onto a finite grid of pixels. Coarse pixels — a large step — blur the curve, and that blur is truncation error. But every pixel value is also recorded to limited precision, and that is round-off. Crank the resolution up without limit and the per-pixel noise, divided by an ever-smaller , comes to dominate. There is a sweet spot, and the first figure is a portrait of it: two error branches, one falling and one rising, crossing at the optimal step where a one-sided derivative reaches its best possible accuracy of roughly — half the sixteen digits of double precision, gone before you start.
Stability is a different question entirely — it is about memory. In a time-stepping calculation, does a mistake made early get forgotten or amplified? A stable scheme behaves like a damped system that forgets perturbations; an unstable one like an inverted pendulum where the tiniest nudge explodes. The cleanest demonstration is forward Euler on a decaying exponential: below a critical step size the numerical solution tracks the true decay, but one step too large and it flips into a growing oscillation — a divergence with nothing to do with formal accuracy and everything to do with the amplification factor per step. The second figure shows both sides of that knife-edge, with the exact solution for reference.
Conditioning, finally, lives in the problem and not the solver. Subtracting from loses six of seven significant figures before a line of code runs — catastrophic cancellation, which no algorithm recovers from; the only cure is to reformulate the problem so it never happens.
The core equations
Numerical differentiation is the cleanest place to watch truncation error appear. The simplest estimate of a derivative replaces the limit in its definition with a small finite step, and Taylor's theorem tells us exactly what we lose.
where: — the true derivative; — the step size, a small positive number; — the leading error, proportional to . Reading it: the forward difference is first order, so halving only halves the error — a poor return a symmetric stencil improves for free. Sampling the function on both sides of cancels the leading error term by symmetry, buying an extra order at the same two function evaluations. This is the workhorse first-derivative formula.
where: — leading error, proportional to . Reading it: the central difference is second order, so halving quarters the error — one order higher than (1) at no extra cost. Every discretization carries a truncation term that falls with and, in finite precision, a round-off term that grows as shrinks. Writing both explicitly gives the most important relation in the subject — the error budget.
where: — problem-dependent constants of order unity; — the order of accuracy; — machine epsilon, the relative round-off unit. Reading it: the first term is the blur, the second the noise; their sum has a genuine minimum at finite , so "smaller " is not a strategy but a trap. The round-off unit is a hard property of the number format, not a fudge factor. In IEEE 754 double precision it is the gap between and the next representable number.
where: — the spacing of the 52-bit mantissa at exponent zero. Reading it: this fixes the noise floor of every calculation at about sixteen decimal digits, and through (3) the best accuracy any single differencing operation can reach. Integration discretizes the opposite way — a continuous area becomes a weighted sum of samples. Joining the samples by straight lines gives the composite trapezoidal rule, whose error is set by the curvature it ignores.
where: — uniform panel width; — sampled values. Reading it: endpoints get weight , interior points weight ; the global error is , so a straight-line fit is second order. Fitting parabolas through triples of points cancels two more orders, giving Simpson's rule — the best return-on-effort quadrature for smooth integrands.
where: — the number of panels, which must be even; the weights are the parabola quadrature coefficients. Reading it: the error is , so halving divides it by sixteen — two orders better than the trapezoid for one extra line of code. Differential equations are marched forward in time by turning the derivative into a difference and stepping. The explicit (forward) Euler method is the prototype of every such integrator.
where: — the numerical solution at time ; — the right-hand side of . Reading it: the local per-step error is , but it accumulates over steps into a global error — Euler is first order, and its stability is a separate matter. Whether the problem amplifies error is a property of the linear system, not the algorithm. For that number is the condition number.
where: — an induced matrix norm, often the 2-norm; always, larger meaning more ill-conditioned. Reading it: is the worst-case amplification of relative input error, so can cost eight digits however carefully the system is solved. For time-dependent partial differential equations, stability couples the time step to the spatial grid. The Courant–Friedrichs–Lewy condition is the archetypal constraint for an explicit wave or advection scheme.
where: — the wave or advection speed; — the time and space step sizes. Reading it: information must not physically outrun the stencil in one step, so refining the spatial grid forces a proportionally smaller time step.
The forward difference has an error made of two competing pieces, and this derivation finds where their sum is smallest. The truncation term grows linearly with the step (it is the dropped Taylor remainder); the round-off term grows like because we divide the noisy difference of two nearly equal function values by a tiny number. Minimising the total over yields a finite best step and, more strikingly, a hard ceiling on the accuracy of any one-sided difference — roughly the square root of machine epsilon, so half of double precision's digits are unreachable in principle.
Step 1. Write the truncation error from the Taylor remainder of the forward difference, . Why: this is exactly the term in equation (1), made quantitative — it is the blur that refinement removes.
Step 2. Write the round-off error. Each evaluation of carries an absolute error of order ; forming the difference and dividing by amplifies it, giving . Why: the subtraction of two close values keeps the noise while cancelling the signal, and the is what makes tiny steps dangerous rather than helpful.
Step 3. Minimise the sum. Setting gives . Why: the two branches cross where their -derivatives balance, and because one rises and one falls the stationary point is a true minimum.
Step 4. Evaluate the floor. At both terms are of order , so a one-sided difference cannot beat about eight correct digits. Why: this is the practical punchline — chasing accuracy by shrinking stalls at the square root of the round-off unit, which is why higher-order stencils, not smaller steps, are the route to precision. *With , one finds — confirming that the accuracy floor of a one-sided difference sits at roughly eight correct digits.*
Go deeper · Derivation B · 1 minAbsolute stability of forward Euler
This derivation isolates stability from accuracy by applying forward Euler to a problem with known exact behaviour — the linear test equation with , whose true solution decays to zero. We ask under what condition the numerical solution also decays, and find a step-size bound with nothing to do with the per-step truncation error. The answer explains why stiff systems (very negative ) force punishingly small steps on explicit methods and drive practitioners to implicit schemes.
Step 1. Apply the scheme. Substituting into (7) gives , so each step multiplies by the amplification factor . Why: the whole dynamics of the numerical solution is compressed into this one number , the growth per step.
Step 2. Iterate. Repeated multiplication gives , a geometric sequence. Why: the numerical solution is exactly a geometric progression, so its fate is decided solely by whether exceeds one.
Step 3. Impose decay. The true solution decays, so we require ; for real this reads , i.e. . Why: this is the absolute-stability condition — a constraint on that survives even as the formal error , because it concerns growth, not fidelity.
Step 4. Read the consequence. If then and the numerical solution oscillates with growing amplitude while the exact one decays; for a stiff problem ( huge) the bound is tiny. Why: this is why implicit methods, whose stability region covers the whole left half-plane, are worth their extra cost on stiff systems — they remove the step-size straitjacket. *For the specific case the stability bound gives , consistent with the amplification-factor analysis above.*
Go deeper · Derivation C · 1 minCatastrophic cancellation and its cure
Conditioning and stability part company most vividly in the quadratic formula. The roots of are perfectly well-conditioned, yet the textbook formula computes one of them by subtracting two nearly equal numbers when , throwing away most of the significant digits. This derivation shows the fault lies entirely in the algorithm, not the problem, and that a one-line reformulation using Vieta's relation restores full accuracy at no extra cost — the template for curing cancellation everywhere it appears.
Step 1. Locate the failure. For and large, the root subtracts two almost equal positive numbers, so the leading digits cancel and only round-off noise survives. Why: the true value is small, but it is computed as a difference of large quantities, and floating point keeps the difference to only as many digits as the cancellation leaves.
Step 2. Compute the safe root first, choosing the sign so the two terms add: , with taken as so the formula remains valid at (where there is no cancellation to cure). Why: with matching signs there is no subtraction of close numbers, so this root keeps all of the mantissa's digits.
Step 3. Recover the dangerous root by division, using Vieta's product , so . Why: division does not cancel significant figures, so the second root inherits the full accuracy of the first — the subtraction is simply never performed.
Step 4. State the lesson. The roots were always well-conditioned; only the naïve arithmetic was unstable, and rearranging it recovers every digit. Why: this is the general moral — when accuracy collapses, suspect the algorithm before the problem, and reformulate to avoid subtracting near-equal quantities. *Vieta's relations and are exact algebraic identities, which is precisely what makes the division step lossless.*
Limiting cases
The behaviour of the total error as the step size or precision changes lays bare the central trade-offs, and the condition number sets the ultimate limit that no algorithm escapes.
| Case | Result | Meaning |
|---|---|---|
| Truncation-dominated ( large) | discretization error dominates and falls as a power of ; the regime where higher order pays off | |
| Round-off-dominated () | for a first derivative, round-off grows as shrinks; refining past the sweet spot makes the answer worse | |
| Optimal step | the sum of both errors is minimal at finite ; for this is | |
| High order, smooth solution | error per halving | for each halving cuts the error 16-fold — if the solution is smooth and the scheme stable |
| Ill-conditioned problem | large amplifies input error however the system is solved — an intrinsic sensitivity, not an algorithmic flaw |
Worked examples
1 · Truncation, order, and the round-off floor (confidence builder)
Estimate for (exact value ) by finite differences, and show the forward and central formulas obey their advertised orders.
Step 1. Forward difference at : , an error of . The predicted truncation error is — the same size, confirming the term dominates. Forward diff error ≈ 0.14.
Step 2. Central difference at : , an error of . The predicted matches to three figures — and the error is 31 times smaller than the forward difference at the same two evaluations. Central diff error ≈ 0.0045.
Step 3. Halve nothing — shrink by ten. Central difference at : , an error of . The error fell by a factor of almost exactly when fell by — the signature of second order. Cutting tenfold cut the central-difference error 100-fold, as demands.
Step 4. Do not chase this forever. By equation (3) the round-off branch turns the total error around near for the first derivative; below that step the difference of two near-equal exponentials is pure noise and the estimate gets worse. The right way to more digits is a higher-order stencil, not a smaller step.
2 · Trapezoid versus Simpson on a known integral
Evaluate (exact value ) with the trapezoidal and Simpson rules, and verify their orders by refining the grid.
Step 1. Trapezoid with panels (): , an error of . Trapezoid, coarse: error ≈ 3.6×10⁻².
Step 2. Refine to (): , an error of . The ratio of errors is — halving quartered the error, exactly the law. Trapezoid halving ÷ 4: confirmed second order.
Step 3. Simpson with (): , an error of — already 60 times better than the trapezoid on the same three points. Simpson, coarse: error ≈ 5.8×10⁻⁴.
Step 4. Refine Simpson to (): , an error of . The ratio — halving cut the error sixteen-fold, the law in action. Simpson halving ÷ 16: confirmed fourth order — two free orders for one weighting.
Physics of the portrait
Numerical analysis had many founders — Newton and Euler gave the first iterations and integrators, Gauss the first quadratures and elimination — but the theory of error this article is really about had one: the man who first explained, precisely, why some algorithms return trustworthy answers to hard problems and others do not.
Origins · 1 minJames H. Wilkinson and how this was discovered
James Hardy Wilkinson began as a Cambridge mathematician, spent the war on ballistics, and in 1946 joined the National Physical Laboratory to work with Alan Turing on the Pilot ACE, one of the first stored-program computers. Programming that machine by hand, he confronted a question the founders had left open: when a computer solves a linear system or eigenvalue problem in finite precision, how far is the answer from the truth, and whose fault is any error? His answer — set out in Rounding Errors in Algebraic Processes (1963) and The Algebraic Eigenvalue Problem (1965) — was backward error analysis: rather than bounding how wrong the computed solution is, show that it is the exact solution of a slightly perturbed problem, and bound that perturbation. This single reframing cleanly separated the two ideas at the heart of this article — a stable algorithm (tiny backward error) from an ill-conditioned problem (one that amplifies any perturbation). A method could now be certified good even for a sensitive problem: the algorithm does its job, and any remaining inaccuracy is charged to the conditioning, measured by the condition number he did so much to popularize. Wilkinson won the Turing Award in 1970 and gave the first SIAM John von Neumann Lecture; the community's habit of trusting a computation only when its backward stability is understood is his legacy.
Going further
Texts. Press, Teukolsky, Vetterling & Flannery, Numerical Recipes, 3rd ed. (Chs. 5, 17, 20) · Trefethen & Bau, Numerical Linear Algebra (SIAM 1997) · Stone & Goldbart, Mathematics for Physics (CUP 2009) · Arfken, Weber & Harris, Mathematical Methods for Physicists, 7th ed. · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, 3rd ed. (Ch. 27). Key numerical benchmarks: machine epsilon and ; central-difference error and trapezoid/Simpson errors from Taylor remainders; worked-example values , , for of , and , , , for (exact ), with error ratios and ; the forward-Euler stability bound from ; and Vieta's relation for the stable quadratic formula.
Prerequisites. Order Symbols and Gauge Functions · Taylor's theorem · Linear algebra. Leads to. Asymptotic Series and Poincaré Expansions · Optimal Truncation and Superasymptotics · WKB Approximation.
Ask the tutor: ask me to walk through the error-budget curve for any specific derivative or integral, and we will find its optimal step size and best achievable accuracy together.
What is the difference between truncation error and round-off error?
Truncation error is what you lose by replacing an exact continuous operation with a finite one — a derivative by a difference quotient, an integral by a sum. It exists even in perfect arithmetic and shrinks as you refine . Round-off error is what you lose by storing numbers to finite precision, about sixteen decimal digits in double precision. It exists even with a perfect formula and grows as shrinks, because refined differences subtract nearly equal quantities. Independent in origin and opposite in trend, they are exactly why the total error has a minimum at a finite step rather than falling forever.
Why can't I just make h as small as I like to get a perfect derivative?
Because at very small the two function values and agree in almost all their digits, so their difference keeps only the few digits where they differ — the rest is round-off noise — and then you divide that noise by a tiny , magnifying it. Formally the error is , which bottoms out near for a first derivative, with a best accuracy of only about eight digits. To do better you change the method — a central difference, a higher-order stencil, complex-step differentiation, or automatic differentiation — not the step size.
Is stability the same as accuracy?
No, and conflating them is the most expensive beginner mistake. Accuracy is how close one step comes to the truth — its order and truncation error. Stability is whether errors already present grow or decay as the calculation proceeds. A high-order method can be unstable, its own round-off blowing up exponentially so the answer is worthless however fine the grid; forward Euler on a stiff equation is the classic case. A useful method must be both accurate enough and stable in the regime you run it — and the Lax equivalence theorem says that for a consistent scheme, stability is exactly what convergence requires.
When should I worry about the condition number?
Whenever you solve a linear system, invert a matrix, or fit data. The condition number is the worst-case factor by which relative input error is amplified. Rule of thumb: if you can lose about of your sixteen double-precision digits, so leaves eight and leaves essentially none. Ill-conditioning is a property of the problem, so no algorithm rescues it; the remedies are reformulation (scaling, regularization) or preconditioning toward . Always suspect a large when a "correct" solver returns nonsense.
How do I choose between the trapezoidal rule, Simpson's rule, and Monte Carlo?
It depends on smoothness and dimension. For a smooth one-dimensional integrand, Simpson's rule () beats the trapezoid () for almost no extra work, and Gauss–Legendre does better still by placing nodes optimally. If the integrand has kinks or discontinuities, high order buys nothing and an adaptive scheme is wiser. In many dimensions the tensor-product cost of grid rules explodes as , so Monte Carlo takes over: its error falls only as , but that rate is independent of dimension — which is why statistical mechanics integrates in hundreds of dimensions by sampling, not gridding.
Why do physicists study numerical error alongside asymptotic series?
Because they are two faces of one idea — approximating an exact result by a controlled, truncated process. Choosing the optimal step that minimises truncation-plus-round-off is the discrete cousin of optimally truncating a divergent asymptotic series at its smallest term to minimise the remainder. The order symbols and are the shared bookkeeping, and the same tension — refine too little and the approximation is crude, too much and a different error takes over — governs both. This is why an introduction to numerical methods sits beside asymptotics, WKB, and superasymptotics: one continuous story about extracting numbers from the intractable.