<<

Jim Lambers MAT 772 Fall Semester 2010-11 Lecture 18 Notes

These notes correspond to Sections 11.5 and 11.6 in the text.

Hermite Cubic Splines

We have seen that it is possible to construct a piecewise cubic that interpolates a 2 f(x) at knots a = x0 < x1 < ⋅ ⋅ ⋅ < xn = b, that belongs to C [a, b]. Now, suppose that we also know the values of f ′(x) at the knots. We wish to construct a piecewise cubic polynomial s(x) that agrees with f(x), and whose derivative agrees with f ′(x) at the knots. This piecewise polynomial is called a Hermite cubic spline. Because s(x) is cubic on each subinterval [xi−1, xi] for i = 1, 2, . . . , n, there are 4n coefficients, and therefore 4n degrees of freedom, that can be used to satisfy any criteria that are imposed on s(x). Requiring that s(x) interpolates f(x) at the knots, and that s′(x) interpolates f ′(x) at the knots, imposes 2n + 2 constraints on the coefficients. We can then use the remaining 2n − 2 degrees of freedom to require that s(x) belong to C1[a, b]; that is, it is continuously differentiable on [a, b]. The following result provides insight into the accuracy with which a Hermite cubic spline inter- polant s(x) approximates a function f(x).

(4) Theorem Let f be four times continuously differentiable on [a, b], and assume that ∥f ∥∞ = M. Let s(x) be the unique Hermite cubic spline interpolant of f(x) on the nodes x0, x1, . . . , xn, where a = x0 < x1 < ⋅ ⋅ ⋅ < xn < b. Then

5M 4 ∥f(x) − s(x)∥∞ ≤ max ℎi , 384 1≤i≤n where ℎi = xi − xi−1. This can be proved in the same way as the error bound for the linear spline, except that the error formula for Hermite is used instead of the error formula for Lagrange interpolation.

Basis Functions for Cubic Splines

An alternative method of computing splines to fit given data involves constructing a for the of splines defined on the interval [a, b], and then solving a system of linear equations for the coefficients of the desired spline in this basis. The basis functions are known as B-splines, where the letter B is due to the fact that these splines form a basis, and the fact that they tend to have bell-shaped graphs.

1 One advantage of using B-splines is that the system of linear equations that must be solved for the coefficients of a spline in the basis is banded, and therefore can be solved very efficiently. Furthermore, because each B-spline has compact support, it follows that a change in the data value yi only causes the coefficients of a few B-splines to be changed, whereas in cubic , such a change forces all of the coefficients of each polynomial si(x) to be recomputed. To define a B-spline of degree n, we first introduce the following notation:  x x ≥ 0 x = . + 0 x < 0

We say that x+ is the positive part of x. Then, we define a spline of degree n, centered at 0, by

n+1 X  n + 1  S (x) = (−1)k (x − kℎ)n . (n) k + k=0 To see that this is in fact a spline of degree n, we first note that on each interval of the form [iℎ, (i + 1)ℎ], for any integer i, S(n)(x) is a linear combination of at most n + 2 of degree n. However, S(n)(x) is only practically useful if it is only nonzero on a finite interval. To that end, we note that for x < 0, S(n)(x) = 0, because x − kℎ < 0 for k ≥ 0. For x ≥ kℎ, we have

n+1 X  n + 1  S (x) = (−1)k (x − kℎ)n. (n) k k=0 It follows that n+1 X  n + 1  S (x) = (−1)k (x − kℎ)n (n) k k=0 n+1 n X  n + 1  X  n  = (−1)k xj(−kℎ)n−j k j k=0 j=0 n "n+1 # X  n  X  n + 1  = (−ℎ)n−j (−1)k kn−j xj j k j=0 k=0 = 0, since the quantity in square brackets, by the theory of finite differences, vanishes. This is closely related to the fact that the (n + 1)-st derivative of a polynomial of degree n or less is equal to zero. By scaling and shifting S(n)(x), we obtain basis functions that are equal to 1 at one of the knots, and 0 at all other knots, so that a spline can be expressed in a similar form as the Lagrange interpolating polynomial: a linear combination of basis functions, where the constants are the values of f(x) at the interpolation points.

2