Skip to main content

6.5.2 Cubic spline interpolation and quadrature

Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §6.5.2–6.5.3. Rewritten in original wording. Continues 6.5b Lagrange interpolation labs. Labs: 6.5.2b Cubic splines labs.

From local polynomials to splines​

A three-point (parabolic) local Lagrange fit already avoids the wild oscillations of a single high-degree global polynomial. Cubic splines push the idea further: fit a cubic polynomial in each interval, but additionally force the first and second derivatives to match at every shared node. The result is a curve that looks and behaves like a physical drafting spline — a flexible strip of material bent through pins at the data points — smooth in both slope and curvature.

Because each piece is only a cubic, splines never show the runaway oscillations of a high-degree Lagrange fit, and because the pieces are matched smoothly, the composite curve can be safely differentiated and integrated. That matters physically: if the interpolated quantity is a potential, its spline derivative gives a well-behaved force.

Matching conditions and panel integral​

On each [xi,xi+1][x_i,x_{i+1}] fit a Taylor cubic about the left node, then glue pieces by value, slope, and curvature. Walk the matching equations and the analytic panel integral — pick the matching formula at each step (lookalikes included).

Interior matching alone leaves two free second derivatives at the ends. Common closures:

  • Natural spline: g′′(a)=g′′(b)=0g''(a)=g''(b)=0.
  • Given first derivatives at the endpoints (measured or estimated) to back out g′′(a)g''(a), g′′(b)g''(b).
  • Given (or estimated) second derivatives directly.

Solving the linear system by hand is mechanical — in practice delegate to a library spline routine rather than rederiving each time. When gg is known only at nodes, summing cubic panel integrals is about as accurate as tabulated quadrature gets; if you can evaluate gg freely, prefer Gauss. Finer panels do not automatically help — subtractive cancellation in the endpoint evaluations can grow.

Quiz

Cubic spline interpolation

1 / 4

A cubic spline enforces continuity, across interval boundaries, of…

Pick an answer to see if you are right.

Next: 6.5.2b Cubic splines labs.