A piece-wise technique which is very popular. Recall the philosophy in splining is to use low order polynomials to interpolate from grid point to grid point. This is ideally suited when one has control of the grid locations and the values of the data being interpolated (i.e. you have a way to produce them at any location). So if we have this control, as we saw above, we can control the relative accuracy by changing the overall spacing between the grid points.
Why cubic splines? Because cubic splines are the lowest order polynomial endowed with inflection points. Think about interpolating a set of data points using parabolic (quadratic) functions: without inflection points the interpolation can look rather strange....why not higher order? because it is more expensive and the eye cannot really discern an appreciable difference between the cubic and higher order interpolating splines.
Here we could have used the method presented in connection with the piece-wise linear splines to construct the spline interpolation of the data using cubics. However, we purposely show an alternative technique, which is less elegant but nevertheless revealing.
Consider functions
such that
then
satisfies these properties:
Cubic Spline
Can such functions be constructed?
So
is represented by the cubic polynomials
on
on
and
on
.
Since
it has 4 coefficients and we'd like it
to satisfy (18) therefore we have 12 coefficients to pin down.
Since each
, all its derivatives are
continuous
for any
(open interval)
therefore need to worry about continuity at each node
only, where cubics ``patch together''with 2-order continuity.
Let
. We need 12 equations for 12 unknowns.
6 equations are generated by:
One of the following is satisfied:
Construction: apply above conditions.
Once
are known then
solved by (33) and
solved by
(30)
Natural spline case:
Clamped Case:
and
Algorithm Natural Cubic Spline
input
output
for
Step 1 for
Step 2 for
Step 4 for
Step 5
Step 6 for
Step 7 output
for
)
STOP
Clamped Cubic Spline
input
output (
for
)
Step 1 for
Step 2 Set
FPO
FPN
Step 3 for
Step 5 For
Step 6
Step 7 for
set
Step 8 Output
STOP
Figures 36 and 37 illustrate how cubic spline interpolation compares with a Lagrange polynomial interpolation. It also shows the effect of using different end conditions on the spline interpolation.
In both cases we are using the same knots. The derivative information for the clamped spline case was easy to derive from the function itself. However, we emphasize that this information is not always readily available. The result of the free conditions at the end points for the cubic spline clearly show an effect on the error near the end points.
|