Interpolation & Splines
Estimate values between known data points. Learn linear interpolation, polynomial interpolation (Lagrange form, Newton divided differences, forward/backward differences), interpolation error, Runge's phenomenon, and cubic splines used in CAD, CNC paths and lookup tables.
Steam tables, calibration curves, look-up tables in engine ECUs, and smooth CAD curves all rely on interpolation between tabulated or measured points.
An analogy
Interpolation is like connecting the dots in a puzzle: straight lines between dots (linear) or a smooth pen stroke that bends naturally (splines).
Linear interpolation
The workhorse for tables (steam tables, datasheets). Accurate when data are closely spaced or nearly linear.
Polynomial interpolation
n + 1 points define a unique degree-n polynomial. Lagrange form is conceptually simple; Newton's divided-difference form allows adding points easily.
Runge's phenomenon
High-degree polynomials through equally spaced points oscillate wildly near the ends. Use Chebyshev nodes or, better, piecewise low-degree interpolation.
Splines
Cubic splines join cubic pieces with continuous first and second derivatives — smooth like a draftsman's flexible spline. Natural, clamped and not-a-knot end conditions. B-splines and NURBS underpin CAD.
Formulas
- Linear:
y = y₀ + (y₁ − y₀)(x − x₀)/(x₁ − x₀) - Lagrange:
P(x) = Σ yᵢ Lᵢ(x), Lᵢ = Π_{j≠i} (x − xⱼ)/(xᵢ − xⱼ) - Newton divided differences:
P(x) = f[x₀] + f[x₀,x₁](x − x₀) + f[x₀,x₁,x₂](x − x₀)(x − x₁) + … - Error:
f(x) − P(x) = f⁽ⁿ⁺¹⁾(ξ)/(n + 1)! · Π(x − xᵢ)
Worked example: Quadratic through three points
Given: (1, 1), (2, 8), (3, 27) from f = x³
Find: P(2.5).
- P(x) = 6x² − 11x + 6
- P(2.5) = 37.5 − 27.5 + 6 = 16
Answer: 16 (exact 15.625, error 0.375)
Worked example: Steam table
Given: h = 2675.5 kJ/kg at 100 °C, 2706.0 at 120 °C
Find: h at 110 °C.
- Midpoint → (2675.5 + 2706.0)/2
Answer: 2690.8 kJ/kg
Common mistakes
- Wrong: High-degree polynomials through many equispaced points. — Right: Use splines or Chebyshev nodes.
- Wrong: Extrapolating with interpolants. — Right: Interpolants are unreliable outside the data range.
Applications
- Property tables: Steam, refrigerant and material data.
- ECU look-up tables: Fuel maps and calibration.
- CAD/CAM: Splines and NURBS for smooth geometry.
Key takeaways
- Linear for tables; splines for smoothness.
- Lagrange / Newton forms of polynomials.
- Beware Runge oscillations.
- Don't extrapolate.
Going further
- NURBS: Rational B-splines in CAD.
- Radial basis functions: Scattered-data interpolation in 2D/3D.
- Hermite interpolation: Matching values and slopes.