numerical analysis
Spline Interpolation
You should know: interpolation methods
Overview
A single high-degree polynomial forced through many data points tends to oscillate wildly between the nodes (Runge's phenomenon), especially near the ends of the interval. Spline interpolation sidesteps this by using a different low-degree polynomial (almost always cubic) on each subinterval between consecutive data points, chosen so the pieces join up smoothly: the value, first derivative, and second derivative all match at each interior node. This piecewise construction gives a curve that looks and behaves smoothly to the eye while staying numerically well-behaved even with many data points — which is why splines are the standard tool behind font and vector-graphics curves, CAD/CAM surface design, and smooth trajectory planning in robotics and animation, as well as smooth interpolation of scientific and financial time series.
Intuition
Picture a flexible draftsman's spline — a thin strip of wood or metal historically used to draw smooth curves through fixed pins on a drafting table. The physical strip naturally bends to minimize its own strain energy, producing a smooth curve of least total curvature that passes through every pin without kinks. The mathematical cubic spline mimics this exactly: rather than one rigid polynomial fighting to pass through every point (and overshooting between them), each short piece only has to blend smoothly into its neighbors, so the curve stays gentle and well-behaved everywhere, just like the physical strip relaxing into its natural shape between the pins.
Formal Definition
For nodes x₀ < x₁ < ⋯ < xₙ with values y₀, …, yₙ, a cubic spline is a piecewise cubic Sᵢ(x) on each [xᵢ, xᵢ₊₁] that agrees with the data and joins continuously in value, slope, and curvature at every interior node. Writing cᵢ = Sᵢ''(xᵢ)/2, the natural spline (which additionally sets the curvature to zero at both endpoints) solves a tridiagonal linear system for the interior cᵢ:
Worked Examples
With natural boundary conditions c₀ = c₂ = 0 and equal spacing h₀ = h₁ = 1, the single interior unknown c₁ solves the reduced tridiagonal equation.
Solve for c₁.
Compute b₀ and d₀ for the first piece S₀ on [0,1], using c₀=0, c₁=−1.5, h₀=1.
Assemble S₀(x) = y₀ + b₀(x−0) + c₀(x−0)² + d₀(x−0)³ and evaluate at x=0.5.
Answer: S(0.5) = 0.6875 — smoothly rising toward the peak at x=1, unlike a straight-line (linear) interpolation, which would give only 0.5 at the midpoint.
Practice Problems
For the natural cubic spline through (0,0), (1,1), (2,0), what value does the tridiagonal system give for c₁?
Using S₀(x) = 1.5x − 0.5x³ (the first piece of the spline through (0,0),(1,1),(2,0)), evaluate S₀ at x = 0.25.
A font's letter outlines are drawn using cubic Bézier/spline curves through anchor points rather than a single high-degree interpolating polynomial through all the anchor points on a letter. Why?
Quiz
Summary
- Spline interpolation uses piecewise low-degree (usually cubic) polynomials, joined so value, slope, and curvature match at each interior node, avoiding the oscillation of a single high-degree interpolating polynomial.
- Natural cubic splines additionally set curvature to zero at both endpoints (c₀ = cₙ = 0), reducing the construction to solving a tridiagonal linear system for the interior second-derivative coefficients cᵢ.
- For (0,0),(1,1),(2,0), the natural spline gives c₁ = −1.5 and first piece S₀(x) = 1.5x − 0.5x³, so S(0.5) = 0.6875.
- Splines are the standard tool behind font/vector-graphics curves, CAD surface design, and smooth robotics/animation trajectories, because editing one point only affects nearby segments (local control).
References
- BookBurden, R. L. & Faires, J. D. Numerical Analysis, 10th ed. Cengage, 2015.
Mathematics