Cubic Spline Interpolation
Cubic splines derive their name from a tool used by boat builders: it's a metal band, passed between fixed points to give a pleasing shape to a hull.
We want to pass a cubic through a bunch of knots so that a pleasing shape appears. We saw in the last section that we can pass cubics through a pair of points that ``osculate'' the true curve: that's Hermite interpolation.
We're going to use a different criterion in this section, which doesn't require knowledge of the derivatives at particular values, but which has not only slope continuity at the knots, but also second derivative continuity! It might seem odd that we can do this, as it seems that we don't have that much freedom - but, in fact, we can accomplish this feat.
There is a trade-off from Hermite splines, however, in that we can't control the actual values of the slope or second derivative: we just know that they're equivalent. That's the difference from Hermite, in which we actually specify the derivative values....
The cubics are generally expressed in shifted form, as
Example: #3a, p. 152
Example: #4a, p. 152
Example: #5a, p. 152
Whereas for Hermite splines the individual cubics are determined locally, and can be successively generated along the way, the free or clamped cubic splines must be generated all at once: the conditions involved in their creation give rise to a system of linear equations, which must be simultaneously satisfied. We need some linear algebra!
Theorem 3.11: If f is defined at , then f has a unique natural spline interpolant on the nodes .
Theorem 3.12: If f is defined at and differentiable at a and b, then f has a unique clamped spline interpolant on the nodes .
Theorem 3.13: Let with on [a,b]. If S is the unique clamped cubic spline, then
Linear splines are actually pretty popular, but though they are continuous, they aren't differentiable, which is a pretty serious problem.
Quadratic splines aren't very popular, because they don't have enough free parameters to be really useful: they give us fit, and then we can match derivatives at the nodes, but the problem is that once we've determined the starting slope at , say, the slope at is determined: we have no freedom to adjust that (all our free parameters are used up). So we're stuck with whatever we get, and that can be ugly.
Each cubic polynomial making up a spline has four free parameters, which it can use to satisfy four constraints: on each subinterval, we satisfy two constraints for interpolation, leaving us with two free parameters on each subinterval.
On the first subinterval, we satisfy a boundary derivative condition (either first or second derivative), and then we have one free parameter left. Once that parameter is fixed, the next subinterval cubic is stuck: it has to use its two free parameters to meet the first and second derivatives at its left endpoint; and so on, down the line, until we reach the last subinterval.
At the last subinterval, we have to satisfy the two constraints on the left endpoint, so it seems that we won't be able to satisfy the last derivative condition (either first or second derivative) on the right endpoint. But wait: we haven't actually established the choice of the free parameter on the first subinterval! As we play with that parameter, we can ultimately get the behavior we want on the far endpoint, and we stop. There is a unique choice of that free parameter that will give us the desired behavior, which is why we need to solve a system of equations to get the coefficients.
We determine the coefficients of each of the cubic polynomials by matching their coefficients. Consider, for example, a trio of internal cubics , , and .
Now when we evaluate at the left endpoint knot of these, we obtain
because of the interpolation. The derivative at the left endpoint is also easy, being . But this is unspecified!