## Cubic Splines

Cubic splines are preferred for many applications. Consider the spline composed ofcubic polynomials of the form

(1)

so that,(2) and(3) for

The interpolating function must pass through all the data points, be continuous,

and have continuous derivative at the interior points. Furthermore, there are enough degrees

of freedom to impose continuous curvature as well (continuity of second derivative) at the interior points.

(4)

(5)

(6)

(7)

We haveunknowns andequations (from each of (1) and (2) andfrom each of (3) and (4). Hence, we have the freedom to impose two extra conditions.

We can saythe width of theinterval, and

Next, we shall write all the equations in terms of(given) and C-k (unknown) only.

From equations (3) and (7)

From equations (1) and (4),

From equations (1) and (5)

So far we have obtained expressions for the coefficientsandin terms ofandAll that remains is to match the slopes at the interior points.

From equations (2) and (6):

Substitute into this(8) and(9) to give

After some simple algebra, we obtain a system ofequations to solve for

The problem as been reduced from findingcoefficientsandto finding

values of the curvature

We only haveequations forbut we can obtain two additional equations by specifying

end conditions on the curvature, i.e. conditions involvingand

Natural or free boundaries: takei.e. the end splines have no curvature at the end points.

Clamped boundaries: fix the slopes at each end to specified values.

Periodic boundaries: take

The last equations can be written in matrix form,

In the case of natural splines (i.e. for), the matrix is non-singular and has a tri-diagonal structure. The solution foris unique and can easily be obtained using rapid tri-diagonal matrix solvers.

We can solveforand from this construct the splines

Example: Find the natural spline for the following data:

1 | 2 | 3 | 4 | |

0 | 1 | 3 | 4 | |

2 | 4 | 3 | 4 |

From this

MC=F becomes

Hence

Thus, using equations (8), (9), andwe obtain