• Aucun résultat trouvé

THE ERROR OF THE INTERPOLATING POLYNOMIAL

FORTRAN SUBPROGRAM FOR INTERPOLATION IN A FUNCTION TABLE

2.5 THE ERROR OF THE INTERPOLATING POLYNOMIAL

numbers

With p0, 1, . . . , j, r(x) (for r > j) the polynomial of degree < j + 1 which agrees with f(x) at the points x0, x1, . . . , xj, and xr.

Show by an operations count that Neville’s algorithm is more expensive than Algorithm 2.4. (Also, observe that Algorithm 2.4 provides, at no extra cost, a Newton form for the interpolating polynomial for subsequent evaluation at other points, while the information generated in Neville’s or Aitken’s algorithm is of no help for evaluation at other points.) 2.4-4 In inverse interpolation in a table, one is given a number and wishes to find the point so that where f(x) is the tabulated function. If f(x) is (continuous and) strictly monotone-increasing or -decreasing, this problem can always be solved by considering the given table xi, f(xi), i = 0, 1, 2, . . . to be a table yi, g(yi), i = 0, 1, 2, . . . for the inverse function g(y) = f-1(y) = x by taking yi = f(xi), g(yi) = xi, i = 0, 1, 2, . . . , and to inter-polate for the unknown value in this table. Use the FORTRAN function TABLE to find

so that

2.5 THE ERROR OF THE INTERPOLATING POLYNOMIAL

Let f(x) be a real-valued function on the interval I = [a,b], and let x0, . . . , xn be n + 1 distinct points in I. With pn(x) the polynomial of degree < n which interpolates f(x) at x0, . . . , xn, the interpolation error

is given by

(2.15) Let now be any point different from x0, . . . , xn. If pn+1(x) is the polynomial of degree < n + 1 which interpolates f(x) at x0, . . . , xn and at

while by (2. 10),

It follows that

Therefore,

(2.16) showing the error to be “like the next term” in the Newton form.

We cannot evaluate the right side of (2.16) without knowing the number But as we now prove, the number is closely related to the (n + 1)st derivative of f(x), and using this information, we can at times estimate

Theorem 2.2 Let f(x) be a real-valued function, defined on [a,b] and k times differentiable in (a, b). If x0, . . . , xk are k + 1 distinct points in [a, b], then there exists such that

(2.17)

For k = 1, this is just the mean-value theorem for derivatives (see Sec.

1.7). For the general case, observe that the error function ek(x) = f(x) -pk(x) has (at least) the k + 1 distinct zeros x0, . . . , xk in I = [a, b]. Hence, if f(x), and therefore ek(x), is k times differentiable on (a, b), then it follows from Rolle’s theorem (see Sec. 1.7) that e’(x) has at least k zeros in (a, b); hence e”(x) has at least k - 1 zeros in (a, b) and continuing in this manner, we finally get that has at least one zero in (a, b). Let be one such zero. Then

On the other hand, we know that, for any x,

since, by definition, f[x0, . . . , xk] is the leading coefficient of pk(x), and (2.17) now follows.

By taking a = min, xi, b = maxi xi, it follows that the unknown point in (2.17) can be assumed to lie somewhere between the xi’s.

If we apply Theorem 2.2 to (2.16), we get Theorem 2.3.

Theorem 2.3 Let f(x) be a real-valued function defined on [a, b] and n + 1 times differentiable on (a, b). If pn(x) is the polynomial of degree < n which interpolates f(x) at the n + 1 distinct points x0, . . . , xn in [a, b], then for all there exists

(a, b) such that

(2.18) It is important to note that depends on the point at which the error estimate is required. This dependence need not even be continu-ous. As we have need in Chap. 7 to integrate and differentiate en(x) with respect to x, we usually prefer for such purposes the formula (2.16). For, as we show in Sec. 2.7, f[x0, . . . , xn, x] is a well-behaved function of x.

The error formula (2.18) is of only limited practical utility since, in general, we will seldom know f(n+1)(x), and we will almost never know the point But when a bound on |f(n+1)(x)| is known over the entire interval [a, b], then we can use (2.18) to obtain a (usually crude) bound on the error of the interpolating polynomial in that interval.

2.5 THE ERROR OF THE INTERPOLATING POLYNOMIAL 53 Example 2.6 Find a bound for the error in linear interpolation.

The linear polynomial interpolating f(x) at x0 and x1 is

Equation (2.18) then yields the error formula

where depends on . If is a point between x0 and x1, then lies between x0 and x1. Hence, if we know that |f”(x)] < M on [x0, x1], then

The maximum value of occurs at

hence is (x1 - x0)2/4. It follows that, for any

Example 2.7 Determine the spacing h in a table of equally spaced values of the function between 1 and 2, so that interpolation with a second-degree polynomial in this table will yield a desired accuracy.

By assumption, the table will contain f(xi), with xi = 1 + ih, i = 0, . . . , N, where th en we approximate where p2(x) is the quadratic polynomial which interpolates f(x) at xi-1, xi, xi+1. By (2.18), the error is then

for some in (xi-1, xi+1). Since we do not know we can merely estimate

One calculates Further,

using the linear change of variables y = x - xi. Since the function

vanishes at y = - h and y = h, the maximum of must occur at one of the extrema of These extrema are found by solving the equation

= 0, giving Hence

We are now assured that, for any

if p2(x) is chosen as the quadratic polynomial which interpolates at the three tabular points nearest . If we wish to obtain seven-place accuracy this way, we would

have to choose h so that

giving

The function which appears in (2.18) depends, of course, strongly on the placement of the interpolation points. It is possible to choose these points for given n in the given interval a < x < b in such a way that max there is as small as possible. This choice of points, the so-called Chebyshev points, is discussed in some detail in Sec.

6.1. For the common choice of equally spaced interpolation points, the local maxima of increase as one moves from the middle of the interval toward its ends, and this increase becomes more pronounced with increasing n (see Fig 2.3). In view of (2.18), it is therefore advisable (at least when interpolating to uniformly spaced data) to make use of the interpolating polynomial only near the middle data points. The interpolant becomes less reliable as one approaches the leftmost or rightmost data point. Of course, going beyond them is even worse. Such an undertaking is called extrapolation and should only be used with great caution.

Figure 23 The function equally

(solid); (b) Chebyshev points for the same interval (dotted).

EXERCISES

spaced interpolation points

2.5-l A table of values of cos x is required so that linear interpolation will yield six-decimal-place accuracy for any value of x in Assuming that the tabular values are to be equally spaced, what is the minimum number of entries needed in the table?

2.5-2 The function defined by

2.6 INTERPOLATION AT EQUALLY SPACED POINTS 55 has been tabulated for equally spaced values of x with step h = 0.1. What is the maximum error encountered if cubic interpolation is to be used to calculate any point on the interval

2.5-3 Prove: If the values f(x0), . . . , f(xn) are our only information about the function f(x),

then we can say nothing about the error at a point that

is, the error may be “very large” or may be “very small.” [Hint: Consider interpolation at x0, x1, . . . , xn to the function f(x) = K(x - x0) · · · (x - xn), where K is an unknown constant.] What does this imply about programs like the FUNCTION TABLE in Sec. 2.4 or Algorithm 2.4?

2.5-4 Use (2.18) to give a lower bound on the interpolation error when

2.6 INTERPOLATION IN A FUNCTION TABLE BASED ON