Professional Documents
Culture Documents
Cubic Spline Interpolation
Cubic Spline Interpolation
JAN FEYS
S0 (x)
if x [x0 , x1 )
S1 (x)
if x [x1 , x2 )
S(x) =
.
..
j = 0, 1, . . . , n 2.
(2 extra conditions) There are multiple choices here for the two extra conditions.
Two frequently used sets of conditions are the free or natural boundary conditions
S 00 (x0 ) = S 00 (xn ) = 0
or the clamped boundary conditions
S 0 (x0 ) = f 0 (x0 ),
S 0 (xn ) = f 0 (xn ).
Two interpolation conditions: S0 (x0 ) = f (x0 ) and S1 (x1 ) = f (x1 ). We get back
a0 = f (x0 ) = 0 and a1 = f (x1 ) = 1,
two continuity conditions: S0 (x1 ) = f (x1 ) and S1 (x2 ) = f (x2 ). Thus
1 = S0 (x1 ) = a0 + b0 (x1 x0 ) + c0 (x1 x0 )2 + d0 (x1 x0 )3 = b0 + c0 + d0
and
2 = S1 (x2 ) = a1 + b1 (x2 x1 ) + c1 (x2 x1 )2 + d1 (x2 x1 )3 = 1 + b1 + c1 + d1 ,
2
two smoothness conditions: S00 (x1 ) = S10 (x1 ) and S000 (x1 ) = S100 (x1 ). Thus respectively
b0 + 2c0 (x1 x0 ) + 3d0 (x1 x0 )2 = b1 + 2c1 (x1 x1 ) + 3d1 (x1 x1 )2
and
2c0 + 6d0 (x1 x0 ) = 2c1 + 6d1 (x1 x1 ).
By plugging in all the values we know they reduce to
b0 + 2c0 + 3d0 = b1
and
2c0 + 6d0 = 2c1 .
Two extra conditions: the free boundary conditions S 00 (x0 ) = 0 and S 00 (x2 ) = 0
simplify to
2c0 + 6d0 = 0
and
2c1 + 6d1 = 0.
All the equations are there. Let us summarize them into one list of eight.
a0
=0
a1
=1
b0 + c0 + d0
=1
1 + b1 + c1 + d1
=2
b0 + 2c0 + 3d0
2c0 + 6d0
2c0 + 6d0
2c1 + 6d1
= b1
= 2c1
=0
=0
One can either pour this system into matrix shape or attempt to solve it in a sequential
manner. We will do the latter. Equation six and seven imply c1 = 0. Equation eight
3
a0
=0
a1
=1
=1
b0 + c0 + d0
b
=1
1
b0 + 2c0 + 3d0 = 1
c1
=0
2c0 + 6d0
=0
d1
= 0.
Combining equations three and five gets
c0 + 2d0 = 0
which leads to c0 = 0 and d0 = 0 when combined with equation seven. This also means
b0 = 1. Conclusion is that the cubic spline is in this case
S (x) = x
if x [0, 1)
0
S(x) =
S1 (x) = 1 + (x 1) = x if x [1, 2).
This makes sense because the function f could have just been f (x) = x.
Quadratic and quartic splines are defined in a similar way by expanding or trimming the
list of smoothness conditions.