A spline is a lower order polynomial applied to a subset of points in the data set. A polynomial interpolation fits one curve to all points, while a spline interpolation fits them one curve per interval.

Linear Spline Interpolation

For data points, there are to intervals. Each interval can be described by a function.

For linear interpolation, each interval can be described by its interval, intercept and slope:

Combining these, the whole spline would look like:

Notes

The weakness of linear splines is the abrupt transitions at data points (known as knots). Smooth transitions at knots requires that the function value, and the derivative(s) be equal at each data point. For example, a second‐order spline is continuous in magnitude and
first derivative at the data points.

Quadratic Spline Interpolation

A quadratic spline has the form:

For data points there would be intervals and thus constants .

At a given interval, , so

so our number of constants is reduced to constants .

The functions have to be equal at both knots and , such that

We can simplify this by letting , which allows us to write the above expression as:

This gives us equations (one for each interval from ). We still need another equations to solve for coefficients. We find these by enforcing continuity of first derivative (slope) at the interior points. For each interval:

At each point, we check that the slope is continuous by checking

where .

This gives us more equations, which means we need one more equation. In the absence of additional information, we can assume that the second derivative is zero at the first data point. This is a common approach to generate the last equation, and results in:

which implies that the first 2 points are connected by a straight line.

At this point, we can form a system of equations for the constants and solve it.

Cubic Spline Interpolation

We determine the coefficients for 3rd order polynomials corresponding to each interval:

As before, we enforce:

  1. Cubics join at the knots (continuity in magnitude)
  2. First derivative of interior knots must be equal (continuity of first derivative)
  3. Second derivative of interior knots must be equal (continuity of second derivative)
  4. To get the required number of equations, we need 2 more conditions. Some options are:
    • Nature spline (second derivatives = 0 at end points)
    • Clamped end condition (first derivatives = 0 at the end points)
    • Not-a-knot end condition (force continuity of the third derivative at the second and next‐to‐last knots)