Module

for

B-Splines

   

Cubic spline construction using the B-spline function.

    Under special circumstances a basis set of splines [Graphics:Images/B-SplinesMod_gr_1.gif] can be used to form a cubic B-spline function.  This concept makes the construction of a spline very easy, it is just at linear combination:   

        [Graphics:Images/B-SplinesMod_gr_2.gif]

All we need to do is solve for the  [Graphics:Images/B-SplinesMod_gr_3.gif] coefficients [Graphics:Images/B-SplinesMod_gr_4.gif].  And to make things even more appealing, the linear system to be solved has a tri-diagonal "appearance":   

        [Graphics:Images/B-SplinesMod_gr_5.gif][Graphics:Images/B-SplinesMod_gr_6.gif] = [Graphics:Images/B-SplinesMod_gr_7.gif].  

Caution must prevail when solving this underdetermined system of  [Graphics:Images/B-SplinesMod_gr_8.gif]  equations in  [Graphics:Images/B-SplinesMod_gr_9.gif] unknowns.  Two end conditions must be supplied for constructing the coefficients [Graphics:Images/B-SplinesMod_gr_10.gif] and [Graphics:Images/B-SplinesMod_gr_11.gif].  These end conditions are specially crafted to form either a natural cubic spline or a clamped cubic spline.  

    How can such an elegant construction possible ?  It's simple, you must have a uniform grid of points  [Graphics:Images/B-SplinesMod_gr_12.gif] on the interval  [Graphics:Images/B-SplinesMod_gr_13.gif].  The uniform spacing is [Graphics:Images/B-SplinesMod_gr_14.gif] and the interpolation nodes to be used are [Graphics:Images/B-SplinesMod_gr_15.gif] for  [Graphics:Images/B-SplinesMod_gr_16.gif].  The equally spaced abscissa's are

        [Graphics:Images/B-SplinesMod_gr_17.gif]  

The corresponding ordinates are  [Graphics:Images/B-SplinesMod_gr_18.gif]  and the data points are  [Graphics:Images/B-SplinesMod_gr_19.gif].  They are often times referred to as the knots because this is where we join the piecewise cubics, like pieces of string "knotted" together to form a larger piece of string.  If this is your situation, then the B-spline construction is for you.  

Caveat. If you have unequally spaced points, then this is construction does not apply and construction of the cubic spline require a more cumbersome algorithm because each piecewise cubic will need to be individually crafted in order to meet all the conditions for a cubic spline.  

 

The basic B-spline function.

    Construction of cubic B-spline interpolation can be accomplished by first considering the following basic function.

The function [Graphics:Images/B-SplinesMod_gr_20.gif] is a piecewise continuous on the interval [Graphics:Images/B-SplinesMod_gr_21.gif] , it is zero elsewhere.  In advanced courses this simple concept is glamorized by saying that [Graphics:Images/B-SplinesMod_gr_22.gif] is a function with "compact support."  That is, it is supported (or non-zero) only on a small set.  

 

[Graphics:Images/B-SplinesMod_gr_23.gif]

The graph of the function [Graphics:Images/B-SplinesMod_gr_24.gif] .

[Graphics:Images/B-SplinesMod_gr_25.gif]

[Graphics:Images/B-SplinesMod_gr_26.gif]

[Graphics:Images/B-SplinesMod_gr_27.gif]
Global`B

[Graphics:Images/B-SplinesMod_gr_28.gif]

[Graphics:Images/B-SplinesMod_gr_29.gif]

[Graphics:Images/B-SplinesMod_gr_30.gif]

[Graphics:Images/B-SplinesMod_gr_31.gif]

[Graphics:Images/B-SplinesMod_gr_32.gif]

[Graphics:Images/B-SplinesMod_gr_33.gif]

 

Verify that  [Graphics:Images/B-SplinesMod_gr_34.gif] is a cubic spline.

Each part of  [Graphics:Images/B-SplinesMod_gr_35.gif] is piecewise cubic.
Are the functions  [Graphics:Images/B-SplinesMod_gr_36.gif],  [Graphics:Images/B-SplinesMod_gr_37.gif]  and   [Graphics:Images/B-SplinesMod_gr_38.gif] continuous for all  [Graphics:Images/B-SplinesMod_gr_39.gif] ?
Since  [Graphics:Images/B-SplinesMod_gr_40.gif]  is composed of the piecewise functions [Graphics:Images/B-SplinesMod_gr_41.gif],[Graphics:Images/B-SplinesMod_gr_42.gif],[Graphics:Images/B-SplinesMod_gr_43.gif],[Graphics:Images/B-SplinesMod_gr_44.gif],[Graphics:Images/B-SplinesMod_gr_45.gif],[Graphics:Images/B-SplinesMod_gr_46.gif], all that is necessary is to see if they join up properly at the nodes  [Graphics:Images/B-SplinesMod_gr_47.gif].  However, this will take 15 computations to verify.  This is where Mathematica comes in handy.  Follow the link below if you are interested in the proof.  

Proof  B-Splines  B-Splines  

 

The above proof that  [Graphics:Images/B-SplinesMod_gr_48.gif]  is a cubic spline used the formulas [Graphics:Images/B-SplinesMod_gr_49.gif],[Graphics:Images/B-SplinesMod_gr_50.gif],[Graphics:Images/B-SplinesMod_gr_51.gif],[Graphics:Images/B-SplinesMod_gr_52.gif],[Graphics:Images/B-SplinesMod_gr_53.gif],[Graphics:Images/B-SplinesMod_gr_54.gif].
It is the analytic way to do things and illustrates "precise mathematical" reasoning.

If you trust graphs, then just look at the graphs of  [Graphics:Images/B-SplinesMod_gr_55.gif],  [Graphics:Images/B-SplinesMod_gr_56.gif],  and  [Graphics:Images/B-SplinesMod_gr_57.gif] and try to determine if they are continuous.  
However, there might be problems lurking about.  If you seek the mathematical truth you should look at the next cell link.  

A careful look at the derivatives.  B-Splines  B-Splines  

 

 

Let's translate the B-spline over to the node [Graphics:Images/B-SplinesMod_gr_58.gif] and use the uniform step size [Graphics:Images/B-SplinesMod_gr_59.gif].  

 

[Graphics:Images/B-SplinesMod_gr_60.gif]

[Graphics:Images/B-SplinesMod_gr_61.gif]

Now form the linear combination for the spline.

[Graphics:Images/B-SplinesMod_gr_62.gif]

[Graphics:Images/B-SplinesMod_gr_63.gif]
[Graphics:Images/B-SplinesMod_gr_64.gif]
[Graphics:Images/B-SplinesMod_gr_65.gif]

At each of the nodes [Graphics:Images/B-SplinesMod_gr_66.gif] for  [Graphics:Images/B-SplinesMod_gr_67.gif] computation will reveal that

[Graphics:Images/B-SplinesMod_gr_68.gif]

[Graphics:Images/B-SplinesMod_gr_69.gif]

[Graphics:Images/B-SplinesMod_gr_70.gif]

[Graphics:Images/B-SplinesMod_gr_71.gif]

[Graphics:Images/B-SplinesMod_gr_72.gif]

[Graphics:Images/B-SplinesMod_gr_73.gif]

[Graphics:Images/B-SplinesMod_gr_74.gif]

[Graphics:Images/B-SplinesMod_gr_75.gif]

[Graphics:Images/B-SplinesMod_gr_76.gif]

[Graphics:Images/B-SplinesMod_gr_77.gif]

If the B-spline is to go through the points  [Graphics:Images/B-SplinesMod_gr_78.gif] for  [Graphics:Images/B-SplinesMod_gr_79.gif], then the following equations must hold true

    [Graphics:Images/B-SplinesMod_gr_80.gif]   for   [Graphics:Images/B-SplinesMod_gr_81.gif].  

For the natural cubic spline, we want the second derivatives to be zero at the left endpoint  [Graphics:Images/B-SplinesMod_gr_82.gif].  

Therefore we must have   [Graphics:Images/B-SplinesMod_gr_83.gif].  

Computation will reveal that

    [Graphics:Images/B-SplinesMod_gr_84.gif]

To construct the natural cubic spline, we must have

    [Graphics:Images/B-SplinesMod_gr_85.gif].

We can solve this equation for the spline coefficient [Graphics:Images/B-SplinesMod_gr_86.gif]

[Graphics:Images/B-SplinesMod_gr_87.gif]

[Graphics:Images/B-SplinesMod_gr_88.gif]

For the natural cubic spline, we want the second derivatives to be zero at the right endpoint  [Graphics:Images/B-SplinesMod_gr_89.gif].   

Therefore we must have   [Graphics:Images/B-SplinesMod_gr_90.gif].  

Computation will reveal that

    [Graphics:Images/B-SplinesMod_gr_91.gif]

To construct the natural cubic spline, we must have

    [Graphics:Images/B-SplinesMod_gr_92.gif].

We can solve this equation for the spline coefficient [Graphics:Images/B-SplinesMod_gr_93.gif]

[Graphics:Images/B-SplinesMod_gr_94.gif]

[Graphics:Images/B-SplinesMod_gr_95.gif]

The above construction shows how to calculate all the coefficients [Graphics:Images/B-SplinesMod_gr_96.gif].

[Graphics:Images/B-SplinesMod_gr_97.gif]

[Graphics:Images/B-SplinesMod_gr_98.gif]
[Graphics:Images/B-SplinesMod_gr_99.gif]

[Graphics:Images/B-SplinesMod_gr_100.gif]

[Graphics:Images/B-SplinesMod_gr_101.gif]

[Graphics:Images/B-SplinesMod_gr_102.gif]

[Graphics:Images/B-SplinesMod_gr_103.gif]

[Graphics:Images/B-SplinesMod_gr_104.gif]

[Graphics:Images/B-SplinesMod_gr_105.gif]

[Graphics:Images/B-SplinesMod_gr_106.gif]

[Graphics:Images/B-SplinesMod_gr_107.gif]

 

Computer Programs  B-Splines  B-Splines  

 

Method I.  B-spline construction using equations.

Illustration using 7 knots.

The following example uses  n = 6.  There are  n+3 = 9  equations to solve and  n+1 = 7  data points or knots.  First set up the 9 equations to be solved.  

[Graphics:Images/B-SplinesMod_gr_108.gif]



[Graphics:Images/B-SplinesMod_gr_109.gif]
[Graphics:Images/B-SplinesMod_gr_110.gif]

Example 1.  Construct the natural cubic spline for the 7 points  [Graphics:Images/B-SplinesMod_gr_111.gif]  
This requires that the spline has the second derivative endpoint constraints   [Graphics:Images/B-SplinesMod_gr_112.gif].  
Solution 1.

 

Example 2.  The construction in Example 1 used the basic functions [Graphics:Images/B-SplinesMod_gr_154.gif] which have support that is slightly wider than the interval containing the abscissas.
This can be verified by graphing  [Graphics:Images/B-SplinesMod_gr_155.gif] on a larger interval.  
Solution 2.

 

Research Experience for Undergraduates

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

 

Download this Mathematica Notebook B-Splines

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004