You are on page 1of 18

o ation

Inte

omia

an

Po

roximation

census of the population of the United States is taken every 10 years.

The foDowing table fists the population, in thonsands of people, from


1940 to 199(t

Year

1940

1960

1950

1970

1980

1990

Population
132,165 151,326 179,323 203,302 226,542 249,633
(in thousands)

P(t)

2 X 108

1940 1950 1960 1970 1980 1990 2000


Year

105
In reviewing these data, we might ask whether they could be used to
provide a reasonable estimate of the population, say, in 1965 or even in

the year 2010. Predictions of this type can be obtained by using a function that fits the given data. This process is called interpolation and is the
subject of this chapter. This population problem is considered throughout the chapter and in Exercises 24 of Section 3.1, 14 of Section 3.2, and
24 of Section 3.4.

One of the most useful and well-known classes of functions mapping the set of real
numbers into itself is the class of algebraic polynomials, the set of functions of the form
Pn(x) = anx n + an_lX n- 1 +

.,. + alx + ao,

where n is a nonnegative integer and ao, ... ,an are real constants. One reason for their
importance is that they uniformly approximate continuous functions. Given any function,
defined and continuous on a closed and bounded interval, there exists a polynomial that
is as "close" to the given function as desired. This result is expressed precisely in the
following theorem. (See Figure 3.1.)

Figure 3.1
y
"..,;"
,I''''

/
1-.

---- ....

/ / ....

"

".."

,,"
---- ........

= f(x)

+E

, / y = f(x) -

Theorem 3.1

Y = P(x)
Y = f(x)

(Weierstrass Approximation Theorem)


Suppose that I is defined and continuous on [a, bJ. For each
mial P(x), with the property that
I/(x) - P(x)1 < E,

> 0, there exists a polyno-

for all x in [a, b].

The proof of this theorem can be found in most elementary texts on real analysis (see,
for example, [Bart, pp. 165-172]).
Another important reason for considering the class of polynomials in the approximation of functions is that the derivative and indefinite integral of a polynomial are easy to

106

C HAP T E R 3

Interpolation and Polynomial Approximation

determine and are also polynomials. For these reasons, polynomials are often used for
approximating continuous functions.
The Taylor polynomials were introduced in the first section of the book, where they
were described as one of the fundamental building blocks of numerical analysis. Given
this prominence, you might assume that polynomial interpolation would make heavy use
of these functions. However, this is not the case. The Taylor polynomials agree as closely
as possible with a given function at a specific point, but they concentrate their accuracy
near that point. A good interpolation polynomial needs to provide a relatively accurate
approximation over an entire interval, and Taylor polynomials do not generally do this. For
example, suppose we calculate the first six Taylor polynomials about Xo = 0 for f (x) = eX.
Since the derivatives of f(x) are all eX, which evaluated at Xo = 0 gives 1, the Taylor
polynomials are
Po(x) = 1,

P j (x)=I+x,

The graphs of the polynomials are shown in Figure 3.2. (Notice that even for the
higher-degree polynomials, the error becomes progressively worse as we move away from
zero.)

Figure 3.2
y

20
: Y = Ps(x)

15

10
.' y = Pix)

--- -- -- --.. -.-

=-..r-'"'"
-1

...

-- ___ .- y =

Pj(x)

y = Po(x)

-,

Although better approximations are obtained for f(x) = eX if bigher-degree Taylor


polynomials are used, this is not true for all functions. Consider, as an extreme example,

r-

,.

3.1

107

Interpolation and the Lagrange Polynomial

using Taylor polynomials of various degrees for f(x)


Since
approximate f(3) =

l/x expanded about Xo

I to

f(x) = x-I, f'ex) = _x- 2, f"(x) = (-1)22. x- 3,


and, in general,

the Taylor polynomials are

To approximate f(3) =
by Pn (3) for increasing values of n, we obtain the values in
Table 3.1 rather a dramatic failure!

lable 3.1

Pn(3)

-1

-5

II

-21

43

-85

Since the Taylor polynomials have the property that all the information used in the
approximation is concentrated at the single point Xo, the type of difficulty that occurs here
is quite common and limits Taylor polynomial approximation to the situation in which approximations are needed only at points close to Xo. For ordinary computational purposes it
is more efficient to use methods that include infOlmation at various points, which we consider in the remainder of this chapter. The primary use of Taylor polynomials in numerical
analysis is not for approximation purposes but for the derivation of numerical techniques
and error estimation.

3.1 Interpolation and the Lagrange Polynomial


Since the Taylor polynomials are not appropriate for interpolation, alternative methods are
needed. In this section we find approximating polynomials that are detemuned simply by
specifying certain points on the plane through which they must pass.
The problem of detemuning a polynomial of degree one that passes through the distinct points (xo, Yo) and (Xl, y}) is the same as approximating a function f for which
f(xo) = Yo and f(xd = YI by means of a first-degree polynomial interpolating, or agreeing with, the values of f at the given points. We first define the functions

X -XI
Lo(x) = - - Xo - XI
and then define

and

LI(x) =

X -Xo
,
Xo

Xl -

108

C HAP T E R 3 Interpolation and PolynomIal ApproxImation


Since

we have
P(Xo)

= 1 . !(xo) + 0 . !(x!) = !(xo) = Yo

and
P(XI) =

o !(xo) + 1 !(XI) =

!(x!) = YI.

So P is the unique linear function passing through (xo, Yo) and (XI, YI). (See Figure 3.3.)

Figure 3.3
Y
Y == f<x)

Yo == f(Xo)

Y = P(x)

To generalize the concept of linear interpolation, consider the construction of a polynomial of degree at most n that passes through the n + 1 points
(xo, !(xo, (XI, !(xd), ... ,(xn , !(x n )).

(See Figure 3.4.)

Figure 3A
y

y = f(x)

y = P(x)

3.1

109

Interpolation and the Lagrange Polynomial

In this case we need to construct, for each k = 0, 1, ... ,n, a function Ln,k(X) with
the property that Ln,k (Xi) = when i =1= k and Ln,k (Xk) = 1. To satisfy Ln,k (Xi) = 0 for
each i =1= k requires that the numerator of Ln,k (x) contains the telln

(x - xo)(x - XI) ... (x - Xk_I)(X - Xk+l) ... (x - xn).

To satisfy Ln,k(Xk) = 1, the denominator of Ln,k(X) must be equal to this term evaluated
at x = Xk. Thus,
(x - xo) ... (x - Xk-l)(X - xk+d ... (x - xn)
,

(Xk - xo) ... (Xk - Xk-l)(Xk - XH1) ... (Xk - xn)

A sketch of the graph of a typical Ln,k is shown in Figure 3.5.

Figure 35

The interpolating polynomial is easily described once the fOlln of Ln,k is known. This
polynomial, called the nth Lagrange interpolating polynomial, is defined in the following theorem.

'nIeorem 3.2

If Xo, XI, ... ,Xn are n + 1 distinct numbers and f is a function whose values are given at
these numbers, then a unique polynomial P (x) of degree at most n exists with
f(xd = P(xd,

for each k = 0, 1, ... ,n.

This polynomial is given by


P(x)

f(xo)Ln,o(x)

+ ... + f(xn)Ln,n(x)

f(Xk)Ln,k(X),

(3.1)

k=O

where, for each k = 0, 1, ... , n,


(3.2)

We will write Ln,k(X) simply as Lk(X) when there is no confusion as to its degree.

110

C HAP T E R 3

EXAMPLE 1

Using the numbers (or nodes) Xo = 2, XI = 2.5, and X2 = 4 to find the second interpolating
polynomial for I(x) = l/x requires that we determine the coefficient polynomials Lo(x),
LI (x), and L2(X). In nested form they are

Interpolation and Polynomial Approximation

(x - 2.5)(x - 4)
Lo(x) = (2 _ 2.5)(2 _ 4) = (x - 6.5)x
(x - 2)(x - 4)
1-(2.5-2)(2.5-4)

L (x) _

(-4x

+ 10,

+ 24)x

- 32

'

and
(x - 2) (x - 2.5)
(x - 4.5)x
L2(X) = (4 _ 2)(4 - 2.5) =
3

Since I(xo)

= 1(2)

= 0.5, I(x))

1(2.5)

+5
.

0.4, and l(x2)

= 1(4) = 0.25, we

have
2

P(x) =

L l(xk)Lk(X)
k=O

= 0.5x - 6.5)x

+ 10) + 0.4

= (0.05x - 0.425)x

(-4x

+ 24)x 3

32

+ 0.25

(x - 4.5)x

+5

+ 1.15.

An approximation to 1(3) =

(see Figure 3.6) is


P(3) = 0.325.

1(3)

Figure 3.6
y
4
3

2
1

Compare this to Table 3.1, where no Taylor polynomial, expanded about Xo = 1, could
be used to reasonably approximate 1(3) =

t.

3.1

111

Interpolation and the Lagrange Polynomial

We can use a CAS to construct an interpolating polynomial. For example, in Maple


we use

>interp(X,Y,x);
where X is the list [xo, ... , xn], Y is the list [f(xo), ... , f(xn)], and x is the variable to be
used. In this example we can generate the interpolating polynomial p = 0.05x2 - 0.425x +
1.15 with the command

>p:=interp([2,2.5,4], [0.5,0.4,0.25] ,x);


To evaluate p(3) as an approximation to f(3)

= j, enter

>subs(x=3,p);
which gives 0.325.
The next step is to calculate a remainder term or bound for the error involved in approximating a function by an interpolating polynomial. This is done in the following theorem.

Theorem 3.3

Suppose xo, Xl, ... , Xn are distinct numbers in the interval [a, b J and
Then, for each X in [a, b J, a number (x) in (a, b) exists with
f(x) = P(x)

(n

(x - xo)(x - XI) ., . (X - x n ),

I)!

C n + I [a, b J.

(3.3)

where P(x) is the interpolating polynomial given in Eq. (3.1).

Ploof Note first that if X = Xko for any k = 0,1, ... , n, then f(Xk)
P(Xk), and
arbitrarily in (a, b) yields Eq. (3.3). If x i= Xb for all k = 0, 1, ... ,n,
choosing
define the function g for t in [a, b] by
get) = f(t) - pet) _ [f(x) _ P(x)] (t - xo)(t (X - Xo)(X -

= f(t) - pet) - [f(x) - P(x)]

Since
we have

(t - Xi)

i=O

(X - Xi)

E Cn+l[a, b], and P E eOO[a, b], it follows that

g(xd = f(Xk) - P(Xk) - [f(x) - P(x)]

(Xk - Xi)

i=O

(x - Xi)

Xl) ... (t - Xn)


Xl) ... (X - Xn)

.
g E cn+1[a, b]. For t =

Xb

= 0 - [f(x) - P(x)] 0 = O.

Moreover,
g(x) = f(x) - P(x) - [f(x) - P(x)]

(x - X)

O (x i=O

Xi)

= f(x) - P(x) - [f(x) - P(x)] = O.

Thus, g E en+! [a, b], and g is zero at the n + 2 distinct numbers x, Xo, Xl, . " ,Xn . By the
Generalized Rolle's Theorem, there exists a number in (a, b) for which g(n+l)(.;) = O.

112

C HAP T E R 3

Interpolation and Polynomial Approximation

So

fI

(t-Xi)

i=O (x - Xi)

(3.4)
Since P(x) is a polynomial of degree at most n, the (n + l)st derivative, p(n+l) (x), is
identically zero. Also, 07=o[(t - Xi )/(x - Xi)] is a polynomial of degree (n + I), so
n

(t - x)
_ _ _1_

nn

i=O (x - Xi)

i=O(x - Xi)

t n+ 1 + (lower-degree tenns in t),

and
dn+l

dt n + 1

n
1=0

(/ _ Xi)

(n

nn_

(x - x)
=
1

1-0

+ I)!
(x - x)'
1

Equation (3.4) now becomes

o=
and, upon solving for

n(n + 1)!
,
ni=O(x - Xi)

_ 0 _ [f(x) _ P(x)]

(x), we have
f(x) = P(x)

(n

+ 1)!

n
n

(x - Xi).

The error fOIIllula in Theorem 3.3 is an important theoretical result because Lagrange
polynomials are used extensively for deriving numerical differentiation and integration
methods. Error bounds for these techniques are obtained from the Lagrange error fOimula.
Note that the error fonn for the Lagrange polynomial is quite similar to that for the
Taylor polynomial. The nth Taylor polynomial about Xo concentrates all the known information at Xo and has an error term of the form
-'...-_-.:.:.....:......c.c.. (x

(n

+ I)!

n+I
o

X )

The Lagrange polynomial of degree n uses infOIIllation at the distinct numbers Xo, XI,
... ,Xn and, in place of (x - xo)n, its error fOimula uses a product of the n + 1 terms
(x - xo), (x - XI), ... , (x - x n):

en + 1)!

(x - xo)(x - xd ... (x - xn)

The specific use of this error fonnula is restricted to those functions whose derivatives have
known bounds.

EXAMPLE 2

Suppose a table is to be prepared for the function I(x) = eX, for x in [0, 1]. Assume the
number of decimal places to be given per entry is d :: 8 and that the difference between
adjacent x-values, the step size, is h. What should h be for linear interpolation (that is, the
Lagrange polynomial of degree 1) to give an absolute error of at most 10-6 ?

3.1

113

Interpolation and the Lagrange Polynomial

Let XO, Xl, ... be the numbers at which 1 is evaluated, X be in [0,1], and suppose j
satisfies Xj :::: X :::: Xj+!' Eq. (3.3) implies that the error in linear interpolation is
If(x) - P(x)1 =

Since the step size is h, it follows thatxj = jh, Xj+l = (j


I/(x) - P(x)1 ::::

I1(2)

2!

+ l)h and

I(x - jh)(x - (j

+ l)h)l

Hence,

I/(x) - P(x)1 < - max

::::

max

I(x - jh)(x - (j

Xj<X<X}+l

max

I(x - jh)(x - (j

Xj<X<Xj+l

+ l)h)1

l)h)l.

By considering g(x) = (x - jh)(x - (j + l)h), for jh :::: x < (j


the Extreme Value Theorem (see Exercise 28), we find that

max

I(x - jh)(x - (j

Xj:5X:5Xj+l

l)h)1 =

max

Ig(x)1 = g

Xj<X<Xj+l

+
1

+-

l)h, and using

Consequently, the error in linear interpolation is bounded by


I/(x) - P(x)l::::

eh 2

8 '

and it is sufficient for h to be chosen so that


2

eh8 -< 10-6 ,

which implies that

h < 1.72

10-3

Since n = (1 - 0)/ h must be an integer, one logical choice for the step size is h = 0.001.

The next example illustrates interpolation for a situation when the error portion of
Eq. (3.3) cannot be used.

EXAMPLE 3

DIble 3.2

Table 3.2 lists values of a function at various points. The approximations to 1 (l.5) obtained
by various Lagrange polynomials will be compared.

f(x)

1.0
1.3
1.6
1.9
2.2

0.7651977
0.6200860
0.4554022
0.2818186
0.1103623

114

C HAP T E R 3

Interpolation and Polynomial Approximation

Since 1.5 is between 1.3 and 1.6, the most appropriate linear polynomial uses Xo = 1.3
and Xl = 1.6. The value of the interpolating polynomial at 1.5 is
P)(1.5) = (1.5 - 1.6) (0.6200860)

(1.3 - 1.6)

(1.5 - 1.3) (0.4554022) = 0.5102968.


(1.6 - 1.3)

Two polynomials of degree 2 can reasonably be used, one by letting


and X2 = 1.9, which gives
P (1.5) = (1.5 - 1.6)(1.5 - 1.9) (0.6200860)
2

(1.3 - 1.6)(1.3 - 1.9)

Xo

1.3,

XI

1.6,

(1.5 - 1.3)(1.5 - 1.9) (0.4554022)


(1.6 - 1.3)(1.6 - 1.9)

(1.5 - 1.3)(1.5 - 1.6) (0.2818186)


(1.9 - 1.3)(1.9 - 1.6)

= 0.5112857,
and the other by letting Xo = 1.0, XI = 1.3, and X2 = 1.6, which gives
P2(1.5) = 0.5124715.

In the third-degree case, there are also two reasonable choices for the polynomial. One
is with Xo = 1.3, XI = 1.6, X2 = 1.9, and X3 = 2.2, which gives
P3(1.5) = 0.5118302.

The other is obtained by letting Xo

= 1.0, Xl

= 1.3, X2

= 1.6, and X3 = 1.9, which gives

P3(1.5) = 0.5118127.

Xl

The fourth-degree Lagrange polynomial uses all the entries in the table. Withxo = 1.0,
1.3, X2 = 1.6, X3 = 1.9, and X4 = 2.2, the approximation is

P4 (1.5)

= 0.5118200.

Since P3(1.5), P3(1.5), and P4 (1.5) all agree to within 2 x 10-5 units, we expect
this degree of accuracy for these approximations. We also expect P4(1.5) to be the most
accurate approximation, since it uses more of the given data.
The function we are approximating is the Bessel function of the first kind of order
zero, whose value at 1.5 is known to be 0.5118277. Therefore, the true accuracies of the
approximations are as follows:
IPl(1.5) - 1(1.5)1 ;:::; 1.53 x 10-3 ,
IP2(1.5) - 1(1.5)1;:::; 5.42 x 10-4 ,
IP2 (1.5) - 1(1.5)1;:::; 6.44 x 10- 4 ,
,

IP3(1.5) - 1(1.5)1;:::; 2.5 x 10- 6 ,


IP3(1.5) - 1(1.5)1;:::; 1.50 x 10-5 ,
IP4 (1.5) - 1(1.5)1;:::; 7.7 x 10- 6

-
r
,

3.1

115

Interpolation and the Lagrange Polynomial

Although P3 (1.5) is the most accurate approximation, if we had no know ledge of the
actual value of 1(1.5), we would accept P4 (1.5) as the best approximation since it includes
the most data about the function. The Lagrange error telIn derived in Theorem 3.3 cannot
be applied here since no knowledge of the fourth derivative of I is available. Unfortunately,
this is generally the case.

A practical difficulty with Lagrange interpolation is that since the error term is difficult
to apply, the degree of the polynomial needed for the desired accuracy is generally not
known until computations are determined. The usual practice is to compute the results
given from various polynomials until appropriate agreement is obtained, as was done in
the previous example. However, the work done in calculating the approximation by the
second polynomial does not lessen the work needed to calculate the third approximation;
nor is the fourth approximation easier to obtain once the third approximation is known,
and so on. We will now derive these approximating polynomials in a manner that uses the
previous calculations to greater advantage.

Definition 3.4

Let I be a function defined at Xo, XI , Xz, . . . ,Xn , and suppose that m I , mz, . .. , m k are k
distinct integers, with 0 < mi < n for each i. The Lagrange polynomial that agrees with
I(x) at the k points xml' x m2 ' .. ,xmk is denoted Pml ,m2, ... ,mk(x),

EXAMPLE 4

If Xo = 1, XI = 2, Xz = 3, X3 = 4, X4 = 6, and I (x) = eX, then PI ,2,4 (x) is the polynomial


that agrees with I(x) at XI = 2, X2 = 3, and X4 = 6; that is,
(x - 3)(x - 6) z
(x - 2)(x - 6) 3
(X - 2)(x - 3) 6
P1,2,4(X) = (2 _ 3)(2 _ 6) e + (3 _ 2)(3 _ 6) e + (6 _ 2)(6 _ 3) e .

The next result describes a method for recursively generating Lagrange polynomial
approximations.

Theorem 3.S

Let I be defined at Xo,


Then

XI, ... ,

Xb and let Xj and Xi be two distinct numbers in this set.

P(X) = (x -Xj)PO,I, ... ,j-I.j+I, .. ,k(X) - (x -Xi)PO,I, .. ,i-l,i+I,. .. ,k(X)


(Xi - Xj)

describes the kth Lagrange polynomial that interpolates I at the k+ 1 points Xo,
A

XI, . . . .

Xk .

Proof Foreaseofnotation,let Q = PO,I, .. ,i-l,i+I, ... ,k and Q = PO,], ... ,j-IJ+l.,k. Since
Q (X) and Q (x) are polynomials of degree k - 1 or less, P (x) is of degree at most k. If
< r < k and r =F i, j, then Q(xr) = Q(xr) = I(xr), so
A

P(x ) = (Xr - Xj)Q(xr ) - (x, - Xi)Q(xr )


r
Xi - Xj
A

Moreover, since Q(Xi) = I(x;), we have

116

C HAP T E R 3 Interpolation and Polynomial Approximation

Similarly, since Q(Xj) = I(xj), we have P(Xj) = I(xj). But, by definition,


PO, I, ... ,k(X) is the unique polynomial of degree at most k tbat agrees with I at Xo, XI, .. , ,Xk.
Thus, P
po. I .... k'

Theorem 3.5 implies that the interpolating polynomials can be generated recursively.
For example, they can be generated in the manner shown in Table 3.3, where each row is
completed before the succeeding rows are begun.

'Jable 33

Po = Qoo

PI

P2
P3
P4

= QI.O
= Q20

=
=

Q3.0
Q4.0

PO.I =
=
P 2.3 =
P3.4 =
Pl,2

QI,I

Q2,1
Q3.1
Q4.1

-Q
2.2
-Q
3,2
P,2,3,4 --Q4,2
Po0.1,2
P1,2,3

Po0,1,2,3 -- Q 3,3
P1,2,3,4 --Q4,3

PO.1,2,3,4 = Q4.4

This procedure is called Neville's method .. The P notation used in Table 3.3 is cumbersome because of the number of subscripts used to represent the entries. Note, however,
that as an array is being constructed, 'only two subscripts are needed. Proceeding down the
table corresponds to using consecutive points Xi with larger i, and proceeding to the right
corresponds to increasing the degree of the interpolating polynomial. Since the points appear consecutively in each entry, we need to describe only a starting point and the number
of additional points used in constructing the approximation.
To avoid the mUltiple subscripts, let Qi,j(X), for 0 < j < i, denote the interpolating
polynomial of degree j on the (j + 1) numbers Xi _ j, Xi _ j+ J, . ,Xi -I, Xi; that is,

..
QI,}

.. .

. I'

I-}.l-}+ , ... ,1- ,1'

Using this notation for Neville's method provides the Q notation array in Table 3.3.

EXAMPLE 5

Values of various interpolating polynomials at X = 1.5 were obtained in Example 3 using


the data shown in the first two columns of Table 3.4. In this example, we approximate
1(1.5) using the result in Theorem 3.5. If xo = 1.0, XI =: 1.3, X2 = 1.6, X3 =: 1.9, and
X4 =: 2.2, then Qo,o =' 1(1.0), QI,O = 1(1.3), Q2,O = 1(1.6), Q3,O = 1(1.9), and
Q4,O = 1(2.2). These are the five polynomials of degree zero (constants) that approximate
1(1.5).
Calculating the first-degree approximation QJ,J (1.5) gives

QJ,J (1.5)

=:

(x - xo) QI,O - (x XI - Xo

XI) Qo,o

(1.5 - 1.0)Ql,O - (1.5 - 1.3)Qo,o


1.3 - 1.0

0.5(0.6200860) - 0.2(0.7651977)

= 0.5233449.

0.3
Similarly,

5 - (1.5 - 1.3)(0.4554022) - (1.5 - 1.6)(0.600860) _ 0 5102968


1.6-1.3
- .
,

Q2,1(1. ) -

Q3,1 (1.5) = 0.5132634,

and

Q4,1 (1.5) = 0.5104270.

3.1

117

Interpolation and the Lagrange Polynomial

The best linear approximation is expected to be Q2.1 since 1.5 is between Xl = 1.3
and X2 = 1.6.
In a similar manner, approximations using higher-degree polynomials are given by
(1.5 - 1.0)(0.5102968) - (1.5 - 1.6)(0.5233449)
1.6 - 1.0

Q2.2(l.5)

Q3,z(1.5)

= 0.5112857,

and

Q4z(1.5)

= 0.5124715,

= 0.5137361.

The higher-degree approximations are generated in a similar manner and are shown in

Table 3.4.

'!able 3A

1.0
1.3
1.6
1.9
2.2

0.7651977
0.6200860
0.4554022
0.2818186
0.1103623

0.5233449
0.5102968
0.5132634
0.5104270

0.5124715
0.5112857
0.5137361

0.5118127
0.5118302

0.5118200

If the latest approximation, Q4,4, is not sufficiently accurate, another node, Xs, can be
selected, and another row added to the table:
Xs

Qs,o

QS.I

Qs.z

QS,3

QS,4

Qs,s

Then Q4,4, QS.4, and Qs,s can be compared to determine further accuracy.
In our example, the function is the Bessel function of the first kind of order zero, whose
value at 2.5 is -0.0483838, and a new row of approximations to f(1.5) is
2.5

- 0.0483838

0.4807699

0.5301984

0.5119070

0.5118430

0,5118277.

The final new entry, 0.5118277, is correct to seven decimal places.

EXAMPLE 6

Table 3.5 lists the values of f (x) = In x accurate to the places given.

'!able 3.5

x-I

Inxi

2.0
2.2
2.3

0.6931
0.7885
0.8329

1
2

We will use Neville's method to approximate f(2.1) = In2.1. Completing the table
gives the entries in Table 3.6.

'!able 3.6

Xi

0
1
2

2.0
2.2
2.3

X -

Xi

0.1
-0.1
-0.2

QiO

Qil

Qi2

0.6931
0.7885
0.8329

0.7410
0.7441

0.7420

118

C HAP T E R 3 Interpolation and Polynomial Approximation

Thus, P2(2.1) = QZ2 = 0.7420. Since f(2.1) = In2.1 = 0.7419 to four decimal
places, the absolute error is
If(2.1) - P2(2.1)1 = 10,7419 - 0.74201
= 10- 4 .

However, f'(x) = ljx, fl/(x) = -ljx 2, and fl/I(X) formula (3.3) gives an error bound

If (2. 1) -

P2 (2.1) I =

1'"3!
1

2jx 3, so the Lagrange error

(x - xo)(x - x,)(x - X2)

-5
(0.1)(-0.1)(-0.2) < 8.3 x 10 .

Notice that the actual error, 10- 4 , exceeds the error bound, 8.3 x 10-5 . This apparent
contradiction is a consequence of finite-digit computations. We used four-digit approximations, and the Lagrange error formula (3.3) assumes infinite-digit arithmetic. This caused
our actual errors to exceed the theoretical error estimate.
_
Algorithm 3.1 constructs the entries in Neville's method by rows.

Neville's Iterated Interpolation


To evaluate the interpolating polynomial P on the n
number x for the function f:

+ 1 distinct numbers Xo,

...

,X n

at the

numbers x, Xo, x" ... , Xn ; values f(xo), f(xd, ... , f(x n ) as the first column
Qo.o, Q,.o, ... , Qn.O of Q.

INPUT
OUTPUT

the table Q with P(x) = Qn.n.

Step 1 For i = l, 2, ... , n


for}=1,2 .... ,i
set Qi.j =

Step 2

OUTPUT (Q);
STOP.

(x - Xi-j)Qi.j-l - (x -

Xi)Qi-l.j-l

Xi - Xi-j

The algorithm can be modified to allow for the addition of new interpolating nodes.
For example. the inequality

can be used as a stopping criterion, where E is a prescribed error tolerance. If the inequality is true, Qi.i is a reasonable approximation to f(x). If the inequality is false, a new
interpolation point, Xi+b is added.

3.1

E X ERe I 5 ESE T
1.

119

Interpolation and the Lagrange Polynomial

3.1

For the given functions f(x), let Xo = 0, XI = 0.6, and Xz = 0.9. Construct interpolation
polynomials of degree at most one and at most two to approximate f(0.45). and find the
actual error.

a.

f(x) = cosx

c.

f(x) = In(x

+ 1)

b.

f(x)=v'I+x

d.

f(x) = tan x

2.

Use Theorem 3.3 to find an error bound for the approximations in Exercise I.

3.

Use appropriate Lagrange interpolating polynomials of degrees one, two, and three to approximate each of the following:
a.

f(8.4) if f(8.1) = 16.94410, f(8.3) = 17.56492, f(8.6) = 18.50515, f(8.7)


18.82091

b.

f (-D if f(-0.75) = -0.07181250, f(-0.5)


0.33493750, f(O) = 1.10100000

c.

f(0.25) if f(O.1) = 0.62049958, f(0.2) = -0.28398668, f(0.3)


f(O.4) = 0.24842440

0.00660095,

d.

f(0.9) if 1(0.6) = -0.17694460, 1(0.7) = 0.01375227, 1(0.8)


f(1.0) = 0.65809197

0.22363362,

-0.02475000, f(-0.25)

4.

Use Neville's method to obtain the approximations for Exercise 3.

5.

Use Neville's method to approximate v'3 with the function


XI = -l,xz =0,X3 = l,andx4 =2.

6.

Use Neville's method to approximate v'3 with the function f(x) = Fx and the values Xo = 0,
XI = 1, Xz = 2, X3 = 4, and X4 = 5. Compare the accuracy with that of Exercise 5.

7.

The data for Exercise 3 were generated using the following functions. Use the error formula
to find a bound for the error, and compare the bound to the actual error for the cases n = I and
n = 2.
a.
f(x) = X Inx

8.
9.
10.

f (x)

= 3' and the values Xo = -2,

+ 4.001xZ + 4.002x + 1.101


+ 3x - 1

b.

f(x) = x 3

c.

f(x) = xcosx - 2xZ

d.

f(x) = sin (eX - 2)

Let I(x) = v'x - x 2 and Pz(x) be the interpolation polynomial on Xo = 0, Xl and Xz = I.


Find the largest value of Xl in (0,1) for which f(0.5) - Pz (O.5) = -0.25.
Let P3 (x) be the interpolating polynomial for the data (0, 0), (0.5, y), (1,3), and (2,2). Find
y if the coefficient of x3 in P3(x) is 6.
Use the Lagrange interpolating polynomial of degree three or less and four-digit chopping
arithmetic to approximate cosO.750 using the following values. Find an error bound for the
approximation.
cos 0.698 = 0.7661

cos 0.733 = 0.7432

cos 0.768 = 0.7193

cos 0.803 = 0.6946

The actual value of cos 0.750 is 0.7317 (to four decimal places). Explain the discrepancy
between the actual error and the error bound.
11.

Use the following values and four-digit rounding arithmetic to construct a third Lagrange polynomial approximation to 1(1.09). The function being approximated is lex) = 10glO(tanx).
Use this knowledge to find a bound for the error in the approximation.
f(1.00) = 0.1924

f(1.05) = 0.2414

f(1.10) = 0.2933

l(1.15) = 0.3492

110

C HAP T E R 3

Interpolation and Polynomial Approximation

12.

Repeat Exercise 11 using Maple and ten-digit rounding arithmetic.

13.

Neville's method is used to approximate f(O.5), giving the following table.


Xo =0
XI

POI = 3.5

= 004

P 12

X2 = 0.7

rOl2

= 7"27

Determine P2 = f(0.7).

14.

Neville's method is used to approximate f(OA), giving the following table.


Xo =0

= 0.25
X2 = 0.5

XI

X3 = 0.75

Po = 1
PI = 2
P2
P3 = 8

POI = 2.6
P I2
P23 = 204

PO l2

P I23 = 2.96

P0123 = 3.016

Determine P2 = f(0.5).
15.

Construct the Lagrange interpolating polynomials for the following functions, and find a bound
for the absolute error on the interval [xo, xn].

c.

= e2x cos3x, Xo = 0, Xl = 0.3, X2 = 0.6, n = 2


= sin(lnx), Xo = 2.0, XI = 204, X2 = 2.6, n = 2
f(x) = lnx, Xo = I, XI = 1.1, X2 = 1.3, X3 = lA, n ::;:: 3

d.

f(x)

a.

b.

16.

f(x)

f(x)

= cos X + sinx,

Xo

= 0, XI

::;::

0.25, X2 = 0.5,

X3

= 1.0, n =

Let f(x) = eX, for 0::: X < 2.

a.

Approximate f(0.25) using linear interpolation with Xo = 0 and XI = 0.5.

b.

Approximate f(0.75) using linear inte.tpolation with Xo

c.

Approximate f(0.25) and f(0.75) by using the second interpolating polynomial with
XI = 1. and X2 = 2.
Which approximations are better and why?

== 0.5 and XI =

1.

Xo = 0,

d.
17.

Suppose you need to construct eight-decimal-place tables for the common, or base-10, logaX = 10 in such a way that linear interpolation is accurate to
within 10-6 Determine a bound for the step size for this table. What choice of step size would
you make to ensure that x = 10 is included in the table?

rithm function from x == 1 to

18.

Suppose Xj

= j, for j = 0, 1,2,3 and it is known that


PO,I(X) = X + 1,

19.

Find PO. I .2.3(1.5).


Suppose X j = j, for j

21.

and

P I ,2,3(1.5) = 4.

and

P1.2.3(2.5) = 3.

= 0, 1, 2, 3 and it is known that

PO. I (x) = 2x

20.

PI,2(X) = 3x - I,

+ 1,

PO.2(x) = X

+ 1,

Find PO I 2,3(2.5).
Neville's Algorithm is used to approximate f(O) using f( -2), f( -1), f(I), and f(2). Suppose f(-I) was overstated by 2 and f(l) was understated by 3. Determine the error in the
original calculation of the value of the interpolating polynomial to approximate f (0).
Construct a sequence of interpolating values Yn to /(1 + v'IO), where f(x) = (I + X2)-1 for
-5 < X < 5, as follows: For each n = 1,2, ... ,10, let h = lOin and Yn = Pn(l + v'IO),
where Pn(x) is the interpolating polynomial for f(x) at the nodes xanl, xinl, ...
and

3.1

121

Interpolation and the Lagrange Polynomial

xj") = -5
1(1

+ jh, for each

j = 0, 1,2, ... ,n. Does the sequence {Yn} appear to converge to

+ -vItO)?

Inverse Interpolation Suppose I E Cl[a, b], I'(X) i- 0 on [a, b] and I has one zero
p in [a, b]. Let xo, ... ,xn, be n + I distinct numbers in [a, b] with I(Xk) = Yk> for each
k = 0, I, ... ,n. To approximate p construct the interpolating polynomial of degree n on the
nodes Yo, ... ,Yn for I-I. Since Yk = I(Xk) and 0 = I(p), it follows that I-I (Yk) = Xk
and p = I-I (0). Using iterated interpolation to approximate I-I (0) is called iterated inverse
interpolation.
22.

23.
24.

Use iterated inverse interpolation to find an approximation to the solution of x - e- X = 0,


using the data

0.3

Q4

Q5

Q6

e- X

0.740818

0.670320

0.606531

0.548812

Construct an algorithm that can be used for inverse interpolation.


The introduction to this chapter included a table listing the population of the United
from 1940 to 1990. Use Lagrange interpolation to approximate the population in
the years 1930, 1965, and 2010.

a.

b.

25.

The population in 1930 was approximately 123,203,000. How accurate do you think your
1965 and 2010 figures are?
It is suspected that the high amounts of tannin in mature oak leaves inhibit the growth of
the winter moth (Operophtera bromata L., Geometridae) larvae that extensively damage these
trees in certain years. The following table lists the average weight of two samples of larvae at
times in the first 28 days after birth. The first sample was reared on young oak leaves, whereas
the second sample was reared on mature leaves from the same tree.

a.
b.

Use Lagrange interpolation to approximate the average weight curve for each sample.
Find an approximate maximum average weight for each sample by determining the maximum of the interpolating polynomial.

Day
Sample I average weight (mg)
Sample 2 average weight (mg)
26.

27.

10

13

17

20

28

6.67
6.67

17.33
16.11

42.67
18.89

37.33
15.00

30.10
10.56

29.31
9.44

28.74
8.89

In Exercise 24 of Section 1.1 a Maclaurin series was integrated to approximate erf(1), where
erf(x) is the normal distribution error function defined by

a.

Use the Maclaurin series to construct a table for erf(x) that is accurate to within 10-4 for
erf(x;), where x; = 0.2i, for i = 0, I, ... ,5.

b.

Use both linear interpolation and quadratic interpolation to obtain an approximation to


erf(
Which approach seems most feasible?

Prove Theorem 1.14 by following the procedure in the proof of Theorem 3.3. [Hint: Let

get)

= I(t) -

(t - xo)n+1

pet) - [/(x) - P(x)] . (

X - XO)n

where P is the nth Taylor polynomial, and use Theorem 1.12.]

+1 '

You might also like