2.4 Spline approximation
polynomial pi (x) =
m
cik x k
(2.41)
k=0
to approximate f (x) for x ∈ [xi , xi+1 ]. Then the coefficients cik are determined from the smoothness conditions at the nonboundary data points with the lth-order derivative there satisfying (l)
(l)
pi (xi+1 ) = pi+1 (xi+1 ),
(2.42)
for l = 0, 1, . . . , m − 1. These conditions and the values pi (xi ) = f i provide (m + 1)(n − 1) equations from the nonboundary points. So we still need m + 1 equations in order to solve all the (m + 1)n coefficients aik . Two additional equations p0 (x0 ) = f 0 and pn−1 (xn ) = f n are obvious and the remaining m − 1 (l) (l) equations are provided by the choice of some of p0 (x0 ) and pn−1 (xn ) for l = m − 1, m − 2, . . . . The most widely adopted spline function is the cubic spline with m = 3. In this case, the number of equations needed from the derivatives of the polynomials at the boundary points is m − 1 = 2. One of the choices, called the natural spline, is made by setting the highest-order derivatives to zero at both ends up to the number of equations needed. For the cubic spline, the natural spline is given by (xn ) = 0. the choices of p0 (x0 ) = 0 and pn−1 To construct the cubic spline, we can start with the linear interpolation of the second-order derivative in [xi , xi+1 ], pi (x) =
1 [(x − xi ) pi+1 − (x − xi+1 ) pi ], xi+1 − xi
(2.43)
where pi = pi (xi ) = pi−1 (xi ) and pi+1 = pi+1 (xi+1 ) = pi (xi+1 ). If we integrate the above equation twice and use pi (xi ) = f i and pi (xi+1 ) = f i+1 , we obtain
pi (x) = αi (x − xi )3 + βi (x − xi+1 )3 + γi (x − xi ) + ηi (x − xi+1 ),
(2.44)
where pi+1 , 6h i p βi = − i , 6h i h i pi+1 f i+1 , − γi = hi 6 fi h i pi ηi = − , 6 hi
αi =
(2.45) (2.46) (2.47) (2.48)
with h i = xi+1 − xi . So if we find all pi , we find the spline. Applying the condition pi−1 (xi ) = pi (xi )
(2.49)
31