Recap: The Limits of Global Polynomials

In our previous lectures, we explored global polynomial interpolation in depth. We established two main approaches:

  1. Barycentric Interpolation on Chebyshev Nodes: This is a robust and efficient method. Using the barycentric formula on Chebyshev nodes provides a numerically stable way to interpolate data that converges well for smooth functions. The cost is for the initial weight calculation and then a fast for each subsequent evaluation.

  2. Chebyshev Basis Interpolation via FFT: This is an even faster alternative. By representing the polynomial in the Chebyshev basis, we can find all the coefficients in a remarkable time using the Fast Fourier Transform (FFT). Evaluation is then done efficiently with Clenshaw’s algorithm.

However, both of these powerful methods share a fundamental characteristic: they are global.

The Global Nature of Polynomial Interpolation

What does “global” mean in this context? If you change just one data point , the entire interpolating polynomial changes everywhere.

  • Lagrange/Barycentric: Changing one alters one term in the sum, affecting the value of for all .
  • Fourier/Chebyshev: Changing one data point alters all the Fourier/Chebyshev coefficients (since each coefficient is an integral or sum over all data points), again changing the entire function.

This global dependency can be a significant drawback. A single measurement error can corrupt the entire model. Furthermore, high-degree polynomials can introduce unwanted oscillations (“wiggles”) between data points, even with well-chosen Chebyshev nodes, especially if the underlying function is not smooth. This is known as a lack of shape preservation.

To overcome these limitations, we shift our paradigm from using a single high-degree polynomial to stitching together multiple low-degree polynomials. This is the world of piecewise polynomial interpolation.

Piecewise Linear Interpolation: The Simplest Case

The most intuitive way to connect a set of data points is with straight lines. This is piecewise linear interpolation.

Given a set of nodes, or “breakpoints,” and corresponding data values , we define a separate linear function on each subinterval .

The Reference Interval Approach: A Powerful Construction Principle

While we can easily write the formula for the line segment on , it’s more instructive to use a powerful and generalizable technique: the reference interval method.

The "Divide and Conquer" of Function Construction

The core idea is to separate the creative work from the mechanical work.

  1. Creative Step (Reference Interval): We solve the simplest possible version of our problem on a standard reference interval, which we’ll take as .
  2. Mechanical Step (Mapping): We use a simple affine map to stretch and shift this “master solution” from the reference interval to any “real” or “current” interval .

Step 1: The Solution on the Reference Interval On , we want a line connecting and . We can construct this using two simple “hat” basis functions:

  • : This is 1 at and 0 at .
  • : This is 0 at and 1 at . The interpolant is then a simple linear combination:

Step 2: Mapping to the Real Interval We map from the reference variable to the real-world variable using the linear transformation:

Substituting this into our reference solution gives the formula for the piecewise linear interpolant on the interval :

This method of building a solution on a simple domain and then mapping it is a cornerstone of numerical methods, especially the Finite Element Method.

Properties of Piecewise Linear Interpolation

  • Continuity: The resulting global function is continuous () but is not differentiable at the breakpoints (it has “corners”).
  • Locality: This is a crucial advantage. If we change a data value , only the two adjacent segments, on and , are affected. The rest of the function remains unchanged. This makes the method robust to local errors.

Cubic Hermite Interpolation: Achieving Smoothness

Piecewise linear interpolation is simple and local, but its lack of smoothness is often a problem. We want a function that is not only continuous but also has a continuous first derivative (). This means the slopes of the polynomial pieces must match up at the breakpoints.

To achieve this, we need more flexibility, so we move from degree 1 (linear) to degree 3 (cubic) polynomials on each segment. A cubic polynomial has four degrees of freedom (). On each interval , we have four pieces of information we can use to pin it down:

  1. The value at the left endpoint:
  2. The value at the right endpoint:
  3. The derivative at the left endpoint:
  4. The derivative at the right endpoint:

This is called Cubic Hermite Interpolation. By explicitly matching both the values and the derivatives at each breakpoint, we guarantee that the resulting piecewise function is smooth.

s

The Problem: Where Do the Derivatives Come From?

This construction is beautiful, but it relies on a critical assumption: that we know the desired derivative values at each breakpoint. In most real-world scenarios, we only have the data values . The derivatives are unknown.

The central challenge of creating smooth, piecewise interpolants is therefore: How do we choose or estimate the derivative values in a sensible way?

This choice is a degree of freedom that gives rise to a whole family of methods.

  • Naive Approach: We could estimate the derivative using a finite difference, e.g., . This often works but can lead to undesirable oscillations.
  • Shape-Preserving Methods: More sophisticated methods choose the values to ensure the resulting curve preserves properties of the data, like monotonicity or convexity. If the data is monotonic, the interpolant should also be monotonic.

Shape-Preserving Splines: Akima, PCHIP

Global polynomial interpolation often fails at shape preservation, introducing “wiggles” where none should exist. This is where specialized cubic Hermite methods shine.

As seen on, for a function that should be monotonic, the global barycentric interpolant (blue) exhibits significant over- and undershoots. In contrast, methods designed for shape preservation produce a much more plausible curve.

  • Akima & Makima: Popular methods that estimate the derivatives based on a local, weighted average of secant slopes. They are known for producing visually pleasing curves.
  • PCHIP (Piecewise Cubic Hermite Interpolating Polynomial): This is the method implemented in MATLAB’s pchip. It guarantees that if the data is monotonic, the interpolant will also be monotonic. It achieves this by carefully constraining the derivative estimates. PCHIP produces a shape-preserving curve, avoiding the oscillations of other methods.

Cubic Splines: Achieving Even Greater Smoothness

Cubic Hermite methods give us a function. What if we need even more smoothness? A cubic spline is a piecewise cubic polynomial that is twice continuously differentiable (). This means the function, its first derivative, and its second derivative are all continuous across the breakpoints.

To achieve this extra degree of smoothness, we must impose an additional constraint. Instead of choosing the first derivatives freely, we enforce the condition that the second derivatives match at each interior breakpoint:

This condition links all the segments together. It turns the local problem of choosing derivatives into a global problem. Applying this condition at every interior node (using the chain rule and a lot of algebra) results in a tridiagonal system of linear equations for the unknown derivative values .

This system is diagonally dominant and can be solved very efficiently in time.

Boundary Conditions: Tying Up the Loose Ends

The system of equations for the second derivative continuity gives us equations for the unknown derivatives . We are two equations short. We need to specify two additional boundary conditions to get a unique solution. Common choices include:

  1. “Clamped” Spline: We specify the true derivatives at the endpoints: and . This is the most accurate if the endpoint derivatives are known.
  2. “Natural” Spline: We assume the second derivatives at the endpoints are zero: and . This corresponds to the physical behavior of a flexible ruler being laid across the points, which would be straight (zero curvature) beyond the last points.
  3. “Not-a-Knot” Spline: This condition forces the third derivative to be continuous at the first and last interior knots ( and ). This effectively means that the first two polynomial pieces are the same cubic, and the last two are the same cubic. It’s a popular default choice when no other information is available.
  4. Periodic Spline: If the function is known to be periodic, we enforce and .

The Optimality of Natural Splines

Why are splines so important? The “natural” cubic spline has a remarkable physical and mathematical property.

Theorem: Minimum Curvature Property

Among all twice-differentiable functions that interpolate the given data points, the natural cubic spline is the one that minimizes the total squared curvature.

Physically, this means the natural spline is the shape a flexible, elastic ruler (a draftsman’s spline) would take if pinned at the data points. It is the “smoothest” possible interpolant in the sense of minimizing bending energy.

The convergence plots show that these various spline methods provide excellent accuracy, especially for smooth functions, demonstrating high orders of convergence ( for the function value). They successfully combine the local flexibility of piecewise polynomials with the high accuracy that comes from enforcing global smoothness conditions.

Continue here: 08 A Grand Review of Interpolation Methods and Splines