Chap. 7). And when the need to interpolate in a table does arise, the

advertisement
CHAPTER
11 INTRODUCTION
Interpolation lies at the heart of classical numerical analysis. There are two
main reasons for this. The first is that in hand computation there is continual
heed to look up the value of a function in a table. In order to find the value of
the function at' nontabulated arguments, it is necessary to interpolate.
Moreover, the highly accurate tables at small increments of the argument
that we take for granted today are mostly of comparatively recent origin.
Therefore, classical numerical analysts developed an extremely sophisticated
group of interpolation methods. Today the need to interpolate arises com
paratively seldom; e.g., on digital computers we almost always generate the
value of a function directly rather than interpolate in a table of values (see
Chap. 7). And when the need to interpolate in a table does arise, the small
increments in the arguments in most tables mean that quite simple
techniques, e.g., linear or quadratic interpolation, will usually suffice. Thus,
while every numerical analyst must know how to interpolate, he will seldom,
if ever, have use for the more sophisticated interpolation techniques.
Why then start the main body of this book with a chapter on interpola
tion? The answer to this question is provided by the second of the reasons
mentioned at the beginning of this section, namely that interpolation for-..
mulas are the starting points in the derivations of many methods in other
areas of numerical analysis. Almost all the classical methods oT numerical
differentiation, numerical quadrature, and numerical integration of ordinary
differential equations are directly derivable from interpolation formulas.
52
INTERPOLATION 53
While modern numerical analysis does not rely so heavily on interpolation
formulas in these areas, their importance and usefulness are still great, as we
shall see in Chaps. 4 and 5. This, then, is ample motivation for treating
interpolation at the outset of this book.
Because we are especially interested in digital-computer applications,
our approach to interpolation will not emphasize interpolation formulas
based on difference techniques since they are seldom used on computers.
Nevertheless, we shall riot ignore finite differences because of their great use
fulness in hand computation and, even on digital computers, for certain
applications (see, for example, Sec. 4.13-1).
Suppose we have a function/(x) which is known (perhaps along with
certain of its derivatives) at a set of points. These points will hereafter be
called the tabula?' points because interpolation so often takes place in a table
of functional values. The object of interpolation is to estimate values of the
function at nontabular points and—at least—to bound the error between the
estimated and true values. Our approach will be to approximate/(x) by a
function y{x) which, at the tabular points, has the same values as/(x) (and
perhaps the given derivative values, if any). Thus, in the language of the
previous chapter, we shall be using exact approximations. In this chapter we
shall consider only the case where y(x) is a polynomial or a function which is
a piecewise polynomial. In the last section of Chap. 6 we shall consider the
case in which y(x) is a linear combination of trigonometric functions.
We shall usually be concerned with interpolation using only values of
the function at the tabular points. Thus our interpolation formula has the
form
/(*) = t lj(x)f(<*j) + E(x) = y(x) + E(x)
(3.1-1)
although the more general formula
/(*) = Z Z M*)f{Haj) + E(x)
jl i = 0
j=l
(3.1-2)
is also of interest, particularly some special cases of it. Our object is to
determine the lj(x) so that
E(aj) = 0
j= 1, ..., w
(3.1-3)
independent of the function/(x). In general, however, for nontabular points
E(x) ± 0
(3.1-4)
Our two aims then, are to determine the /,(x) so that (3.1-3) is satisfied and
to find a representation for E(x) which will enable us to estimate or at least
bound the error for values of x j= aj9 j = 1, ..., n.
54 A FIRST COURSE IN NUMERICAL ANALYSIS
3.2 LAGRANGIAN INTERPOLATION
In this section we consider the case where there are no restrictions on the
spacing of the tabular points. In Sec. 3.3 we shall consider the case of equally
spaced abscissas. Even in the general situation we consider here, however,
the determination of the polynomials /,(x) is straightforward. Since we wish
the error at the tabular points to be zero independent of/(x), it follows using
(3.1-1) and (3.1-3) that
lj(ak) = 6jk
;,fc =!,...,*
(3.2-1)
where 8jk is the Kronecker de\taJ\ Since lj(x) is to be a polynomial, this
requires that it have a factor
(x _ fll)(x - a2) • • • (* - aj- t)(x - nJ+,) ■ • • (x - an)
(3.2-2)
and since Ifa) = 1, we can write
h(x)= r~z—\... /—_ Jl\~(—_ J+1 \... (—ZT~]
(3-2"3)
Note that there are other possible polynomial representations of lj(x) but
(3.2-3) is the only possible polynomial of degree n - 1 and no polynomial of
lesser degree is possible (why?). It is notationally convenient to write lj(x) as
(3.2-4)
where
pn(x) = 0 (x - a,-)
(3-2"5)
To find an expression for E(x\ we consider the function
F(z)=f(z)-y(z)-[f(x)-y(x)]^
Pn\x)
(3.2-6)
with y(x) as in (3.1-1). The function F(z) as a function of z has n + 1 zeros at
the points au .;., an and x [assume for now that x in (3.2-6) is not one of the
tabular points]. Therefore, by applying Rolle's theorem n timesj
f-W-/-(,)-^) -l/M-*8 £
(3.2-7)
has at least one zero in the interval spanned by au ..., an and x. Calling this
zero z = £ and noting that y{n\z) = 0 since lj(z) is a polynomial of degree
n - 1, we have
•f- SJk = 0 unless j = /c, in which case Sjk = 1.
t Here and throughout the book, we shall assume that the functions involved are diflerentiable as many times as necessary for the discussion.
INTERPOLATION 55
0 = F^) = f^)^[f(x)-y(x)]^x)
(3.2-8)
from which, using (3.1-1), it follows that .
E(x) = ?MfM({;)
^
(3.2-9)
where £, which is an unknown function of x, lies in the interval spanned by
au ..., an and x. Although x in (3.2-6) was restricted to be a nontabular
point, E(x), as given by (3.2-9), holds for both tabular and nontabular points
(why?).
Equation (3.1-1) with the /,(*) given by (3.2-4) and E(x) by (3.2-9) is
called the Lagrangian interpolation formula. When n = 2, y(x) is the familiar
formula for linear interpolation
/(i)
ai — a2
/(2)
(3.2-10)
&2 — "i
The polynomials /,(*) are called Lagrangian interpolation polynomials. Our
derivation of the Lagrangian formula has been equivalent to finding that
polynomial of degree n - 1 which passes through the points [aj,f(a})\j = 1,
..., n {3}. Therefore, as we would expect, (3.2-9) indicates that this formula is
exact, that is, E(x) = 0 for all x, for polynomials of degree n - 1 or less. In
general, an interpolation formula which is exact for polynomials of degree r
is said to have an order of accuracy r or to be of order r.
The use of the Lagrangian interpolation formula is straightforward. To
estimate/(x) at a nontabular point, we merely compute y(x) as given by
(3.1-1) using (3.2-4) and (3.2-5) to compute the polynomials /,(x). If we can
estimate or bound the nth derivative of/(x), then the error can be estimated
or bounded using (3.2-9).
ExampBe 3.1 Let/(x) = In x. Given the table of values
estimate the value of In .60.
With ax = .40, a2 = .50, a3 = .70, and a4 = .80, we calculate from (3.2-4)
M.ttK-i "
M-60) = |
/3(.6O) = |
i
and from (3.1-1) we get the approximation
In .60 a -.509975
The true value is In .60 = -.510826. From (3.2-9) we get
4
£4
Sfi A FIRST COURSE IN NUMERICAL ANALYSIS
In the interval (.4, .8). 10i/-W96 < l/c* < KTV256. so that
-;S,W>£(.60)> -tl
and indeed (he difference between the approximate and true values lies within this error.
An alternate approach to that in this section which must Jead to the
same polynomial (why?) and which is more convenient in certain applica
tions is given by the Newton interpolation formula using divided differences
33 INTERPOLATION AT EQUAL INTERVALS
3.3-1 Lagrangiani Interpolation at Equal Intervals
Let the equal spacing be h, so that
•>»-i
(3.3-1)
3nal convenience, it is common to
x = a,. + hm
(3.3-2)
where r = (n + l)/2. Thus m = 6 corresponds to the center of the interval
as functions of m. In particular, fromp.2-3) it'follows that^isTndep^
dent oik and can thus be tabulated as a function of m. When"we use (3 3-2)
and wnte/(ar + hm) as/(m), the Lagrangian interpolation formula becomes
/('«) = .1 hHf (aj) + -^ - /<»>(£)
(3.3.3)
p,,(m) = (m _ r + 1)(w _ r + 2)... ,„(„, + 1}... (w + ,. _ 1}
(3 34)
where
Table 3 1 is a short tabulation of the Lagrangian interpolation polyno
mials lj(m) for „ = 5. Clearly, when „ and „ are such that the /L) are
tabulated, the use of (3.3-3) is quite straightforward on a hand calculator On
llTu C°mpUtfr'lt wil1 seldom be convenient to store such a table; rather
it will be easier to generate the values of lj(m) using (3.2-4).
INTERPOLATION- 57
Table 3.1 Values of the LagraHgiags interpolation polynomials
for n = 5 (x = a3 + Am)
Example 3.2 Using the same data as in Example 3.1 plus the true value of In .60. estimate
the value of In .54.
We have h = .1; using Table 3.1 with m -■= -.6, we get from (3.3-3)
In .54 & -.0416 In .40 -I- .5824 In .50 -j- .5824 In .60 - .1456 In .70
+ .0224 In .80- -.616143
whereas the true value is -.616186.
When the values of lj(m) are not tabulated, for hand computation, in
stead of (3.3-3) it is preferable to ;:se the finite-difference interpolation for
mulas, which we shall discuss in Sec. 3.4. Before proceeding to discuss finite
differences, however, we emphasize that there is one and only one polynomial
of degree n ~ 1 that takes on the values off(x) at the n tabular points'(why 7).
In what follows, we shall write interpolation formulas in a forrn very differ
ent from (3.1-1) or (3.3-3). But as long as these formulas involve polynomials
passing through the same n tabular points, they will be identical to the
Lagrangian interpolation formula.
3.3-2 Finite Differences
In textbooks on classical numerical analysis, the calculus of finite differences
and the interpolation, differentiation, and integration formulas based on it
were always of central importance. This is because, for work on desk calcula
tors, finite differences are^a wonderfully convenient tool. Aside fronAheir
advantages for hand computation, there are certain special applications for
which finite differences are invaluable (see, for example, Sec. 4.13-2). Also
INTERPOLATION 81
Pearson, K. (1920): On the Construction of Tables and on Interpolation, II, Bivariate Interpolation, University of London, Tracts for Computers III, Cambridge University Press, New
York.
Salzer, H. E. (1943): Tables of Coefficients for Inverse Interpolation with Central Differences, J.
Math, and Phys., vol. 22, 210-224.
(1944): Tables of Coefficients for Inverse interpolation with Advancing Differences, J.
Math, and Phys., vol. 23, pp. 75-102.
- (1945): Inverse Interpolation for Eight, Nine, Ten and Eleven Point Direct Interpola
tion, J. Math, and Phys., vol. 24, pp. 106-108.
Scarborough, J. B. (1962): Numerical Mathematical Analysis, 5th ed., The Johns Hopkins Press,
Baltimore.
StefFensen, J. F. (1950): Interpolation, Chelsea Publishing Company, New York.
Whittaker, E. T., and W. Robinson (1948): The Calculus of Observations, 4th ed., Blackie & Son,
Ltd.. Glasgow.
Section 3;2
1. (a) If n is the order of a Lagrangian interpolation formula, show that
where the a} are the tabular points.
(h) For n = 3 and equally spaced tabular points, compute max(ai ai] \ lj(x) | for) = 1, 2, 3.
Use Table 3.1 to estimate the bounds on lj(x) for n = 5. Use these results to make an inference
on the importance of roundoff error in interpolation using equally spaced data.
Section 3.3
2 (a) Using equally spaced data and a three-point Lagrangian formula, find a bound on
lrf'"(x) which, on the interval spanned by the three points, assures a truncation error of less
than 10"d, where d is an integei.
(tf) Similarly, find a bound on /?5/v(.v) when using a five-point Lagrangian formula.
(c) Use these results to estimate the maximum value of h. for both the three- and fivepoint cases, that can be used to interpolate (i) sin x on [ — k, k\, iii) ex on {'-4, 4], and (i:i)
sin 100.* on [ — n, n], with a truncation error of less than 10" !0.
3 (a) Show that y(x) in the Lagrangian interpolation formula is the unique polynomial o;
degree n — 1 passing through the points fa^, / (fl,)].
(h) Use the Lagrangian intcrpolaiion formula to find the cubic passing through the poir.'■;
(-3, -1), (0,2), (3, -2),(6, 10).
4 (a) Do the computation of Examples 3.1 and 3.2 with the same tabular points when
f(x) = sin x.
(b) Repeat part (a) using tan
' a.
*5 Consider the following U\bk for the Bcssei functions J tl(x). /• - 0. 1,2. 1, 4, 5 correctly
rounded to four decimal places
82 A FIRST COURSE IN NUMERICAL ANALYSIS
(a) Suppose you wished to interpolate to find values of J0(x) at x = 2.05 + AjJ = 0,..., 9.
Use the relation
to find a bojmd on the truncation error in the worst case using (i) linear interpolation; (ii) a
Lagrangian three-pouit formula. Which of these methods would you use if you wished to
guarantee a total error in the result for every; of less than 5 x 10"4 in magnitude?
(b) Carry out the interpolation using this method.
(c) Repeat parts (a) and (b) to find values of J,(x) at x = 2.05 + AjJ = 1, ..., 9.
(d) How many correctly rounded decimal places for J0(x) would have to be given for the
use of a five-point Lagrangian formula to give significantly higher accuracy than the three-point
formula?
6 Use the data of Prob. 5 and a three-point Lagrangian formula to approximate (a)
.7,(2.07), (*>)"jp(2.405), (c) Jp(2.64), (d) Jp(2.91), with p = 0, 1, 2.
7 Derive (3.3-8).
8 Show that the first difference (forward, backward, or central) of a polynomial of degree
n is a polynomial of degree n - 1. Thus deduce that the nth difference of a polynomial of degree
n is a constant and the (n + l)st is zero.
9 Difference operators. Define the shifting operator E to be such that Ef(x) =f(x + h).
Using this and the definitions of A, V, and & establish the following identities: (a) A = E - 1; (b)
v = * ~ E~1; (c) S = El/2 - E~ 1/2..Then use these relations to derive relations between A and
V and between A and 6.
*10 (a) Using the rules of Sec. 3.3-2, show that any closed path of the form
results in no contribution to any interpolation formula.
INTERPOLATION 83
(b) Thus deduce that the path from A'"1/* to Ajfk_ , to Ay+1/k_1 results in the same
contribution as the path from ti~lfk to A% to Aj+lfk_{. Similarly, show that the path from
Aj lfk to A%_ j to AJ + x/fc_ j to Ajfk and the path from Aj~ \fk to A'/* result in the same contribu
tion. From these results deduce that any closed path contributes nothing.
(c) Show also that the path from./}^ to A/} to/, contributes nothing.
(d) Use the results of parts (a), (6), and (c) to deduce that all formulas which terminate on
a given difference and start anywhere in the functional-value column are algebraically
equivalent.
*1.1 (a) Given a table of values at an interval /i, discuss how you would generate a new
table ("subtabulate") at an interval ph, 0 < p < 1, by using an appropriate interpolation
formula.
(b) Show that as n -> oo, the left-hand side of (3.3-11) approaches/(a0 + hm) if the series
on the right-hand side converges (see Prob. 19).
(c) Let the forward-difference operator with respect to the interval ph be represented by
A,. Using (3.3-8) and the result of part (/>), show that
AJ,/o= X £(-lH7.)(*PWo
i = 0 Jc-0
W \ l '
7=1.2,...
(d) Use the results of Prob. 9 to show that in operational form
A{yo.= [(i-f Ay-\]%
Use this to calculate A-(, j = 1, 2, 3, 4 in terms of A* and p, retaining terms through A4.
(e) Use the results of part (c) to subtabulate the data of Prob. 5 for J0(x) with (i) p = \\
(ii) p = ±\. Compare the results for p = \ with those of Prob. 5. How could you overcome the
problems that arise near the end of the tabulation?
• 12 (a) Derive the identities
' (b) Use these results to show that £j = r (- lV"rQ(Jr) vanishes and thus deduce that the
right-hand side of (3.3-12) is/-.
13 (a)- Use the results of Prob. 9 to express Newton's backward formula in terms of
backward differences at a0.
(b) Similarly, express Gauss' forward and backward formulas in terms of central differ
ences at a0.
(c) Using the notation nS2m+ % = \(S2m+ifll2 + <52m+ lf_ 1/2), express Stirling's and Bessel's formulas in terms of central differences.
14 (a) Show that in any finite-difference interpolation formula a difference of any order
can be eliminated by using the relation Smfk+l - Smfk = Sm+ lfk or a similar relation for forward
and backward differences.
(b) Use this result and the result of Prob. 13b to eliminate the odd differences from Gauss'
forward formula and thus derive Everett's interpolation formula
(This formula is useful in interpolating in tables which provide auxiliary tables of even central
differences.)
(c) Similarly, eliminate the even differences in Gauss' forward formula to get Steffensens
interpolation formula
v(m\ -f0
-f
y(m).
8
84 A FIRST COURSE IN NUMERICAL ANALYSIS
[Ref.: Hildebrand (1974), pp. 143-144, or Kopal (1961), pp. 50-54.]
♦15 Throwback, (a) Use the result of Prob. 13c to show that the ratio of the coefficient B4
of the fourth central difference in Bessel's formula to the coefficient B2 of the second difference is
(m + l)(m - 2)/12 and that for 0 < m < 1 this ratio varies between -\ and --fa.
(b) Because this ratio varies very little on this interval, consider replacing fl4 by cB2.
Show that B4 - cB2 as a function of m has a maximum independent of c and two minima
dependent on c on [0, 1]. Find the two values of c which equalize the minimum and maximum
values of B4 - cB2 on this interval. Show that one of these values c{ is very nearly equal to the
average value of B4/B2 over [0, 1].
°Ji + Ci[o Jo + o JJJ. This procedure is called throwback; i.e., we have thrown back the effect
of the fourth difference onto the second difference. [Ref.: Kopal (1961), pp. 54-56.]
16 (a) Display the error terms for the Newtonian and Gaussian interpolation formulas
terminated with the difference of order k in terms of h and m.
()
(b)
Use these to derive the error terms for Stirling's and Bessel's formulas terminated with
an odd
dd or even difference.
difference
Section 3,4
17 (a) What abscissas are involved in the calculation of each entry in the table in
Example 3.4 for both the Gaussian and Newtonian formulas?
{b) Verify that the actual error using six differences is consistent with that calculated using
the result of Prob. 16a.
18 (a) How many terms in Gauss's forward formula can be used if x0 is (i) the next to last
entry in a table; (ii) the fourth entry?
{b) Use (3.3-18) and (3.3-19) to show that when m is near zero, Stirling's formula is a
desirable one to use and that when m is near one-half, Bessel's formula is desirable.
♦19 (a) If h is fixed, show that in the limit as n -* oo Newton's forward formula, if it
converges, becomes with a0 = 0
(b) Forf(x) = eax and aQ = 0, show that Ar/0 = (e** - l)r.
(c) By using the result of part (b) in part (a), show that the ratio of the k + 1 and k terms of
the series is given by
(d) By considering this ratio as /c-> oo, deduce that the series in part (a) converges if
e"* < 2 and diverges if e°h > 2 unless x is a positive integral multiple of h, in which case it
converges. (A more difficult result is that for eah = 2 the series converges if and only if x > -h.)
(e) Thus deduce that Newton's forward formula is an asymptotic series for e°x when
e°h > 2. Contrast this with the convergence of the Taylor series for eax for all ax. In practice, why
would we expect Newton's formula to be asymptotic even when eah < 2? fRef.- Hildebrand
(1974), pp. 154-156.]
20 Suppose you have a table of sin x at an interval h = .1. How many tabular points
would have to be used in interpolating in this table to assure a truncation error of less than (a)
10"3; (b) 10"4; (c) 1(T5; independent of a0 and m?
21 Use the data of Prob. 5 and a finite-difference interpolation formula to approximate
(a) JJ2.07), (b) Jp(2.405), (c) Jp(2.64), (d) Jp(2.91), with p = 0, 1, 2. In each case motivate your
choice of a particular interpolation formula and compare the results with those of Prob. 6.
Download