Module

for

Cubic Splines

 

Cubic Spline Interpolant

Definition (Cubic Spline).  Suppose that  [Graphics:Images/CubicSplinesMod_gr_1.gif]  are  n+1  points, where  [Graphics:Images/CubicSplinesMod_gr_2.gif].  The function  [Graphics:Images/CubicSplinesMod_gr_3.gif]  is called a cubic spline if there exists  n  cubic polynomials  [Graphics:Images/CubicSplinesMod_gr_4.gif]  with coefficients  [Graphics:Images/CubicSplinesMod_gr_5.gif]  that satisfy the properties:

I.      [Graphics:Images/CubicSplinesMod_gr_6.gif][Graphics:Images/CubicSplinesMod_gr_7.gif]  
    for  [Graphics:Images/CubicSplinesMod_gr_8.gif].  

II.      [Graphics:Images/CubicSplinesMod_gr_9.gif]  for  [Graphics:Images/CubicSplinesMod_gr_10.gif].  
    The spline passes through each data point.


III.      [Graphics:Images/CubicSplinesMod_gr_11.gif]  for  [Graphics:Images/CubicSplinesMod_gr_12.gif].
    The spline forms a continuous function over [a,b].

IV.      [Graphics:Images/CubicSplinesMod_gr_13.gif]  for  [Graphics:Images/CubicSplinesMod_gr_14.gif].
    The spline forms a smooth function.

IV.      [Graphics:Images/CubicSplinesMod_gr_15.gif]  for  [Graphics:Images/CubicSplinesMod_gr_16.gif].
    The second derivative is continuous.

 

Lemma (Natural Spline).  There exists a unique cubic spline with the free boundary conditions  [Graphics:Images/CubicSplinesMod_gr_17.gif]  and  [Graphics:Images/CubicSplinesMod_gr_18.gif].

Proof Cubic Splines  Cubic Splines  

 

Remark.  The natural spline is the curve obtained by forcing a flexible elastic rod through the points but letting the slope at the ends be free to equilibrate to the position that minimizes the oscillatory behavior of the curve.  It is useful for fitting a curve to experimental data that is significant to several significant digits.  

 

Computer Programs  Cubic Splines  Cubic Splines  

Program (Natural Cubic Spline).  To construct and evaluate the cubic spline interpolant [Graphics:Images/CubicSplinesMod_gr_19.gif] for the  [Graphics:Images/CubicSplinesMod_gr_20.gif] data points  [Graphics:Images/CubicSplinesMod_gr_21.gif],  using the free boundary conditions  [Graphics:Images/CubicSplinesMod_gr_22.gif]  and  [Graphics:Images/CubicSplinesMod_gr_23.gif].

Mathematica Subroutine (Natural Cubic Spline).

[Graphics:Images/CubicSplinesMod_gr_24.gif]

Example 1.  Construct the natural cubic spline for the points [Graphics:Images/CubicSplinesMod_gr_25.gif]  that has the endpoint constraints   [Graphics:Images/CubicSplinesMod_gr_26.gif].  
Solution 1.

 

Example 2.  Construct the natural cubic spline for the points [Graphics:Images/CubicSplinesMod_gr_34.gif]  that has the endpoint constraints   [Graphics:Images/CubicSplinesMod_gr_35.gif].  Use Mathematica's procedure SplineFit.  
Solution 2.

Remark.  There are five popular types of splines: natural spline, clamped spline, extrapolated spline, parabolically terminated spline, endpoint curvature adjusted spline.
When
Mathematica constructs a cubic spline it uses the "natural cubic spline."  

 

Clamped Spline.  

 

Lemma (Clamped Spline).  There exists a unique cubic spline with the first derivative boundary conditions  [Graphics:Images/CubicSplinesMod_gr_38.gif]  and  [Graphics:Images/CubicSplinesMod_gr_39.gif].

Proof Cubic Splines  Cubic Splines  

 

A property of clamped cubic splines.

    
A practical feature of splines is the minimum of the oscillatory behavior they possess.  Consequently, among all functions f(x) which are twice continuously differentiable on [a,b] and interpolate a given set data points [Graphics:Images/CubicSplinesMod_gr_40.gif] , the cubic spline has "less wiggle."  The next result explains this phenomenon.

Theorem (Minimum property of clamped cubic splines).  Assume that  [Graphics:Images/CubicSplinesMod_gr_41.gif]  and  [Graphics:Images/CubicSplinesMod_gr_42.gif]  is the unique clamped cubic spline interpolant for  [Graphics:Images/CubicSplinesMod_gr_43.gif] which passes through [Graphics:Images/CubicSplinesMod_gr_44.gif] and satisfies the clamped end conditions  [Graphics:Images/CubicSplinesMod_gr_45.gif]  and  [Graphics:Images/CubicSplinesMod_gr_46.gif].   Then

        
[Graphics:Images/CubicSplinesMod_gr_47.gif][Graphics:Images/CubicSplinesMod_gr_48.gif].  

Proof Cubic Splines  Cubic Splines  

 

Computer Programs  Cubic Splines  Cubic Splines  

Program (Clamped Cubic Spline).  To construct and evaluate the cubic spline interpolant  S(x)  for the  n+1  data points  [Graphics:Images/CubicSplinesMod_gr_49.gif],  using the first derivative boundary conditions  [Graphics:Images/CubicSplinesMod_gr_50.gif]  and  [Graphics:Images/CubicSplinesMod_gr_51.gif].

[Graphics:Images/CubicSplinesMod_gr_52.gif]

Example 3.  Construct the clamped cubic spline for the points [Graphics:Images/CubicSplinesMod_gr_53.gif]  that has the endpoint constraints   [Graphics:Images/CubicSplinesMod_gr_54.gif].  
Solution 3.

 

Research Experience for Undergraduates

Cubic Splines  Cubic Splines  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Cubic Splines

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004