
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















J. Robert Buchanan
Department of Mathematics
Fall 2006
Given data {(x 0 , f (x 0 )), (x 1 , f (x 1 )),... , (xn, f (xn))} which we
wish to interpolate using a polynomial...
Lagrange interpolating polynomial of degree n,
Determine n + 1 coefficients,
Error term can be difficult to construct and measure.
Interpolate piecewise,
Piecewise linear result not differentiable at xi ,
i = 0 , 1 ,... , n,
Piecewise quadratic not twice differentiable at xi ,
i = 0 , 1 ,... , n,
Piecewise cubic!
For j = 0 , 1 ,... , n − 1 assume
Sj (x) = aj + bj (x − xj ) + cj (x − xj )
2
3 .
We must find aj , bj , cj and dj subject to the conditions specified
in the definition.
Let hj = xj+ 1 − xj then
Sj (xj ) = aj = f (xj )
Sj+ 1 (xj+ 1 ) = aj+ 1 = Sj (xj+ 1 ) = aj + bj hj + cj h
2 j +^ dj^ h
3 j
So far we know aj for j = 0 , 1 ,... , n − 1 and have n equations
and 3n unknowns.
For j = 0 , 1 ,... , n − 1 we have
′ j (x) =^ bj^ +^2 cj^ (x^ −^ xj^ ) +^3 dj^ (x^ −^ xj^ )
2 .
Thus
′ j (xj^ )^ =^ bj
′ j+ 1 (xj+^1 )^ =^ bj+^1 =^ S
′ j (xj+^1 ) =^ bj^ +^2 cj^ hj^ +^3 dj^ h
2 j
Now we have 2n equations and 3n unknowns.
For j = 0 , 1 ,... , n − 1 we have
aj+ 1 = aj + bj hj + cj h
2 j +^ dj^ h
3 j
bj+ 1 = bj + 2 cj hj + 3 dj h
2 j
cj+ 1 = cj + 3 dj hj.
Note: The quantities aj and hj are known.
Solve the third equation for dj and substitute into the other two
equations.
dj =
cj+ 1 − cj
3 hj
aj+ 1 = aj + bj hj + cj h
2 j +
cj+ 1 − cj
3 hj
h
3 j
= aj + bj hj +
h
2 j
3
( 2 cj + cj+ 1 )
bj+ 1 = bj + 2 cj hj + 3
cj+ 1 − cj
3 hj
h
2 j
= bj + hj (cj + cj+ 1 )
Solve the second equation for bj.
hj
(aj+ 1 − aj ) −
hj
( 2 cj + cj+ 1 ) =
hj− 1
(aj − aj− 1 ) −
hj− 1
( 2 cj− 1 + cj )
Collect all terms involving c to one side.
hj− 1 cj− 1 + 2 cj (hj− 1 +hj )+hj cj+ 1 =
hj
(aj+ 1 −aj )−
hj− 1
(aj −aj− 1 )
We have n − 1 equations of this form and n + 1 unknowns.
If S
′′ (x 0 ) = S
′′ 0 (x^0 ) =^2 c^0 =^ 0 then^ c^0 =^ 0 and if S
′′ (xn) = S
′′ n− 1
(xn) = 2 cn = 0 then cn = 0.
Theorem
If f is defined at a = x 0 < x 1 < · · · < xn = b then f has a unique
natural cubic spline interpolant.
c 0
c 1
c 2
. . .
cn− 1
cn
3 h 1
(a 2 − a 1 ) −
3 h 0
(a 1 − a 0 )
3 h 2 (a^3 −^ a^2 )^ −^
3 h 1 (a^2 −^ a^1 ) . . . 3 hn− 1
(an − an− 1 ) −
3 hn− 2
(an− 1 − an− 2 )
If S
′ (a) = S
′ 0
(a) = f
′ (a) = b 0 then
f
′ (a) =
h 0
(a 1 − a 0 ) −
h 0
3
( 2 c 0 + c 1 )
which is equivalent to
h 0 ( 2 c 0 + c 1 ) =
h 0
(a 1 − a 0 ) − 3 f
′ (a).
In matrix form the system of n + 1 equations has the form
A c = y where
2 h 0 h 0 0 0 · · · 0
h 0 2 (h 0 + h 1 ) h 1 0 · · · 0
0 h 1 2 (h 1 + h 2 ) h 2 · · · 0
. . .
0 0 0 hn− 2 2 (hn− 2 + hn− 1 ) hn− 1
0 0 0 · · · hn− 1 2 hn− 1
Note: A is a tridiagonal matrix.
c 0
c 1
c 2
. . .
cn− 1
cn
3 h 0
(a 1 − a 0 ) − 3 f
′ (a)
3 h 1
(a 2 − a 1 ) −
3 h 0
(a 1 − a 0 )
3 h 2
(a 3 − a 2 ) −
3 h 1
(a 2 − a 1 )
. . . 3 hn− 1
(an − an− 1 ) −
3 hn− 2
(an− 1 − an− 2 )
3 f
′ (b) −
3 hn− 1
(an − an− 1 )
Consider the following data:
x f (x)
− 0. 5 − 0. 02475
− 0. 25 0. 334938
The coefficients of the natural cubic spline interpolant are
a b c d
− 0. 02475 1. 03238 0. 0 6. 502
-0.5 -0.4 -0.3 -0.2 -0.
x
1
fHxL