A practical method for interpolating a set of points with a curve is to use cubic splines.
Question:
A practical method for interpolating a set of points with a curve is to use cubic splines. We are given a set {(xi, yi) : i = 0, 1, . . . , n} of n + 1 point-value pairs, where x01 n. We wish to fit a piecewise-cubic curve (spline) f (x) to the points. That is, the curve f (x) is made up of n cubic polynomials fi(x) = ai + bix + cix2 + dix3 for i = 0, 1, . . . , n − 1, where if x falls in the range xi < x < xi+1, then the value of the curve is given by f (x) = fi(x − xi). The points xi at which the cubic polynomials are "pasted" together are called knots. For simplicity, we shall assume that xi = i for i = 0, 1, . . . , n.
To ensure continuity of f (x), we require that
for i = 0, 1, . . . , n − 1. To ensure that f (x) is sufficiently smooth, we also insist that the first derivative be continuous at each knot.
for i = 0, 1, . . . , n − 2.
a. Suppose that for i = 0, 1, . . . , n, we are given not only the point-value pairs {(xi, yi)} but also the first derivatives Di = f' (xi) at each knot. Express each coefficient ai, bi, ci, and di in terms of the values yi, yi+1, Di, and Di+1. (Remember that xi = i.) How quickly can we compute the 4n coefficients from the point-value pairs and first derivatives?
The question remains of how to choose the first derivatives of f (x) at the knots. One method is to require the second derivatives to be continuous at the knots.
for i = 0, 1, . . . , n − 2. At the first and last knots, we assume that f" (x0) = f"0 (0) = 0 and f" (xn) = f"n-1(1) = 0, these assumptions make f"(x) a natural cubic spline.
b. Use the continuity constraints on the second derivative to show that for i = 1, 2, . . . ,n − 1,
c. Show that
d. Rewrite equations (28.21)−(28.23) as a matrix equation involving the vector D = 〈D0, D1, . . . ,Dn〉 of unknowns. What attributes does the matrix in your equation have?
e. Argue that a natural cubic spline can interpolate a set of n + 1 point-value pairs in O(n) time.
f. Show how to determine a natural cubic spline that interpolates a set of n + 1 points (xi, yi) satisfying x0 < x1 < .... < n, even when xi is not necessarily equal to i. What matrix equation must your method solve, and how quickly does your algorithm run?
Step by Step Answer:
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest