Guides

Choosing an interpolation method

How accurate each method is, when it fails, and a simple decision guide for picking one.

Updated 19 October 2026

All interpolation methods agree at the data points. They differ in what happens between them, and that is where accuracy is won or lost. Here's how the main methods compare and how to choose.

Quick decision guide

SituationUse
Lookup table, closely spaced rowsPiecewise linear
Two inputs (steam table, grid)Bilinear
Smooth curve, many pointsCubic spline
3–6 points from a smooth functionPolynomial (Lagrange or Newton)
Noisy measurementsCurve fitting (regression), not interpolation
Value outside the dataAvoid if possible; otherwise linear extrapolation over a short distance

Linear: simple and safe

Linear interpolation can never overshoot. The result always lies between the two neighbouring values. Its error depends on the curvature of the true function and the spacing h between points:

|error| ≤ h² / 8 × max |f″(x)|

Halving the spacing cuts the worst-case error by a factor of four. That's why printed tables use small steps and are meant to be read linearly. Use linear when the data is closely spaced, when you need predictable behaviour, or when the result feeds a safety-relevant calculation and must stay within the data range.

Polynomial: accurate for few points, dangerous for many

A single polynomial through n points can be extremely accurate when the underlying function is itself smooth and polynomial-like. It recovers y = x³ exactly from four points, for example. But as n grows, the polynomial starts to oscillate near the ends of the interval, even for perfectly smooth data. This is Runge's phenomenon.

The classic example is f(x) = 1/(1 + 25x²) sampled at equally spaced points on [−1, 1]. Adding more points makes the polynomial's error near ±1 larger, not smaller. With 11 points the interpolant overshoots to almost 2 near the ends, where the true value is about 0.04–0.06.

Rule of thumb: keep polynomial interpolation to around 6 points or fewer, centred on where you need the value. For more points, use a spline.

Cubic spline: smooth and well-behaved

A cubic spline uses a separate cubic on each interval, matched so that the value, slope and curvature are continuous. It gets most of the smoothness of a polynomial without Runge's phenomenon, because each piece only "sees" nearby data. For smooth functions the error shrinks roughly with h⁴, which is much faster than linear's h².

Things to watch:

  • Overshoot: a spline can still overshoot near sharp changes, for example going negative when the data is all positive. If that matters, use a shape-preserving method such as PCHIP.
  • End conditions: "natural" (zero curvature at the ends), "clamped" (given slopes) and "not-a-knot" give slightly different curves near the first and last points. Software defaults differ.

Extrapolation: the real risk

Every method is reliable only inside the data. Outside it, a polynomial or spline can shoot off in any direction, and even a straight line only holds if the trend really continues. If you must extrapolate, use the simplest model (linear), go as short a distance as possible, and treat the result as an estimate with growing uncertainty.

Noisy data: don't interpolate at all

Interpolation passes exactly through every point, so with noisy measurements it faithfully reproduces the noise. A polynomial through noisy points can be wildly wrong between them. Fit a smooth curve instead, such as a least-squares line or polynomial or a smoothing spline, and accept that it won't hit every point.

Worked comparison: estimating √x

Known values: √1 = 1, √4 = 2, √9 = 3, √16 = 4. Estimate √6 (true value 2.4495):

  • Linear between 4 and 9: 2 + (6 − 4)/5 = 2.4000, an error of 0.049.
  • Cubic polynomial through all four points: about 2.4762, an error of 0.027, roughly half the linear error.

Closer data beats a cleverer method. Adding the single point √6.25 = 2.5 and interpolating linearly between 4 and 6.25 gives 2.4444, an error of only 0.005.

More guides