Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CUBIC SPLINE INTERPOLATION

Given interval [a, b], subdivide it into n subintervals [x0 , x1 ], [x1 , x2 ], . . . , [xn−1 , xn ] where
a = x0 < x1 < · · · < xn = b. A spline function of degree m with nodes xi , i = 0, 1, . . . n
is a function S(x) satisfying the following properties:
(i) S(x) = f (xi ), for every xi , i = 0, 1, . . . n (interpolation conditions).
(ii) S(x) is a polynomial of degree m on each subinterval [xi−1 , xi ], i = 0, 1, . . . n.
(iii) S(x) and its first (m − 1) derivatives are continuous on [a, b].
In this course, we shall discuss only cubic spline. From above definition, a cubic spline
has the following properties:
(i) S(x) = f (xi ), for every xi , i = 0, 1, . . . n (interpolation conditions).
(ii) S(x) is a polynomial of degree 3 on each subinterval [xi−1 , xi ], i = 0, 1, . . . n.
(iii) S(x), S 0 (x) and S 00 (x) are continuous on [a, b].
The cubic spline interpolation S(x) in the interval [xi−1 , xi ] is given by
(xi − x){(xi − x)2 − h2i }
 
S(x) = Mi−1
6hi
(x − xi−1 ){(x − xi−1 )2 − h2i }
 
+ Mi
6hi
1 1
+ (xi − x)fi−1 + (x − xi−1 )fi
hi hi
00
where hi = xi − xi−1 , Mi = S (xi ), fi = f (xi ), and
hi hi + hi+1 hi+1 1 1
Mi−1 + Mi + Mi+1 = (fi+1 − fi ) − (fi − fi−1 ), i = 1, 2, . . . , n − 1.
6 3 6 hi+1 hi
This gives a system of (n − 1) linear equations with (n + 1) unknowns M0 , M1 , . . . , Mn .
To solve the above system, two additional conditions may be taken as M0 = 0 and Mn = 0.
In this case spline is called natural cubic spline.
For equally spaced data points, hi = h for all i, therefore we have
1 
(xi − x)3 Mi−1 + (x − xi−1 )3 Mi

S(x) =
6h
1 h2
+ (xi − x)(fi−1 − Mi−1 )
h 6
1 h2
+ (x − xi−1 )(fi − Mi )
h 6
and
6
Mi−1 + 4Mi + Mi+1 = 2 (fi−1 − 2fi + fi+1 ), i = 1, 2, . . . , n − 1.
h

You might also like