0% found this document useful (0 votes)
36 views12 pages

Interpolation

The document discusses interpolation, which is the process of constructing a function to fit a set of data points. It introduces Lagrange interpolation, where the interpolating polynomial is a linear combination of basis polynomials, and Newton divided difference interpolation, where the polynomial is expressed in terms of its coefficients and divided differences.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
36 views12 pages

Interpolation

The document discusses interpolation, which is the process of constructing a function to fit a set of data points. It introduces Lagrange interpolation, where the interpolating polynomial is a linear combination of basis polynomials, and Newton divided difference interpolation, where the polynomial is expressed in terms of its coefficients and divided differences.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

Chapter 4

Interpolation

Interpolation is the process of constructing a function from a set of data.

Definition 4.1
A function f is said to interpolate the data points {(x0 , y0 ), (x1 , y1), . . . , (xn , yn )}
if it satisfies f (x0 ) = y0 , f (x1 ) = y1 , . . . , f (xn ) = yn .

In simple terms, in interpolation problems we are given a set of (x, y)


points, and our job is to find a function f that passes through these points.
There are many kinds of functions that would do as interpolating functions,
but the most common choice is a polynomial. Polynomials have many desir-
able properties: they are easy to evaluate, they are easy to differentiate and
integrate, and they are well suited to computer implementation.
The following theorem addresses the existence and uniqueness of interpo-
lating polynomials, given distinct x-values, or abscissas.

Theorem 4.1
Let {x0 , x1 , . . . , xn } distinct and {y0 , y1 , . . . , yn } be given. Then there exists
a unique polynomial Pn of degree (at most) n, such that Pn (xi ) = yi for
i = 0, 1, . . . n.

Theorem 4.1 allows us to speak of the interpolating polynomial Pn . We


will examine several different methods for constructing Pn . Although they
each have a different approach, Theorem 4.1 guarantees that the resulting
polynomial is the same no matter how it is constructed.

1
4.1 Lagrange form
(Bradie, Section 5.1)

Consider constructing the interpolating polynomial through the points


(x0 , y0 ) and (x1 , y1). We require a polynomial P1 (x) = a0 + a1 x that satisfies

P1 (x0 ) = y0 and P1 (x1 ) = y1 .

The required values of a0 and a1 be easily shown to be

x1 y0 − x0 y1 y1 − y0
a0 = and a1 =
x1 − x0 x1 − x0

so that
x1 y0 − x0 y1 y1 − y0
P1 (x) = + x.
x1 − x0 x1 − x0
In its present form, it is not clear how this formula for P1 might generalise
to higher degree polynomials. However, if we re-arrange it as follows:

x − x1 x − x0
P1 (x) = y0 + y1
x0 − x1 x1 − x0

we start to observe a pattern. Notice how the coefficient of y0 has the value
one at x = x0 and zero at x = x1 . Conversely, the coefficient of y1 has the
value zero at x = x0 and one at x = x1 . Let us write P1 (x) as

P1 (x) = L1,0 (x)y0 + L1,1 (x)y1

where L1,0 (x) = xx−x 1


0 −x1
is one at x = x0 and zero at x = x1 ; and L1,1 (x) =
x−x0
x1 −x0
is zero at x = x0 and one at x = x1 .
This suggests how we can generalise this method for any number of points.
We write Pn (x) as

Pn (x) = Ln,0 (x)y0 + Ln,1 (x)y1 + . . . + Ln,n (x)yn (4.1)


Xn
= Ln,i (x)yi
i=0

where Ln,i (x) has the value one at x = xi and zero at all the other xj s. We

2
write (
1, i=j
Ln,i (xj ) = (4.2)
0, i 6= j

Example 4.1 Verify that Pn (x) as defined by (4.1) satisfies Pn (xj ) = yj for
j = 0, 1, . . . , n.

All that remains to determine is precisely what form the Ln,i take.

Example 4.2 Show that Ln,i defined by

(x − x0 )(x − x1 ) . . . (x − xi−1 )(x − xi+1 ) . . . (x − xn )


Ln,i (x) = (4.3)
(xi − x0 )(xi − x1 ) . . . (xi − xi−1 )(xi − xi+1 ) . . . (xi − xn )
n
Y x − xj
=
j=0,j6=i
xi − xj

satisfies (4.2).

Definition 4.2
Given the distinct abscissas x0 , x1 , . . . , xn and function values y0 , y1, . . . , yn ,
the polynomial Pn defined by
n
X
Pn (x) = Ln,i (x)yi
i=0

where n
Y x − xj
Ln,i (x) =
j=0,j6=i
xi − xj

is called the Lagrange form of the interpolating polynomial.

Like we did in Chapter 1 with the Taylor polynomial, it is possible to


find an expression for the error incurred in approximating f (x) by the inter-
polating polynomial Pn (x). We need the following theorem from calculus.

Theorem 4.2 (Generalised Rolle’s theorem) Let f be continuous on


[a, b] and have n continuous derivatives on (a, b), and let f be zero at n + 1
distinct points in [a, b]. There there exists a number c in (a, b) such that
f (n) (c) = 0.

3
Theorem 4.3 (Lagrange form of remainder)
Suppose that f is n + 1 times continuously differentiable on an interval [a, b]
containing the distinct abscissas x0 , x1 , . . . , xn , and let Pn be the interpolating
polynomial. Then for all x in [a, b] there is at least one value c in [a, b] such
that
f (n+1) (c)
f (x) = Pn (x) + (x − x0 )(x − x1 ) . . . (x − xn ) .
(n + 1)!
The term
f (n+1) (c)
Rn (x) = (x − x0 )(x − x1 ) . . . (x − xn ) (4.4)
(n + 1)!
is called the Lagrange form of the remainder term for the interpolating
polynomial.

Example 4.3

(a) Find the Lagrange form of the interpolating polynomial for the function
f (x) = cos(x) and the abscissas x0 = 0, x1 = π/2, x2 = π/6.

(b) Find an upper bound on the error incurred when using this polynomial
to estimate cos(π/3).

(c) Use the polynomial to estimate cos(π/3), and compare the error in the
approximation to the theoretical bound.

Example 4.4

(a) Find the Lagrange form of the interpolating polynomial for the following
data:

i 0 1 2 3
xi 1.0 2.0 3.0 4.0
yi 0.0000 0.6931 1.0986 1.3863

(b) Given that these data come from the function f (x) = log(x), find an
upper bound on the error incurred when using this polynomial to esti-
mate log(2.5).

(c) Use the polynomial to estimate log(2.5), and compare the error in the
approximation to the theoretical bound.

4
4.2 Newton divided difference form
(Bradie, Section 5.3)

In the previous section we derived the Lagrange form of the interpolating


polynomial. The Lagrange form is straightforward to analyse and prove
theorems about, however for computational purposes it is not ideal.
To understand why this is so, suppose we have fit the interpolating poly-
nomial through the n data points {(x0 , y0 ), (x1 , y1 ), . . . (xn , yn )}, and are sub-
sequently given an additional point (xn+1 , yn+1 ) to include in the interpola-
tion. Using the Lagrange form, we must start again from scratch. None of
the terms that we computed are of any use, because they don’t include the
contribution from the point (xn+1 , yn+1 ).
Ideally, we would like a method for constructing the interpolating poly-
nomial Pn that allows us to keep all our previous work, and compute Pn+1
by simply including an additional term.
In the Newton form of the interpolating polynomial, Pn is expressed as

Pn (x) = a0 +a1 (x−x0 )+a2 (x−x0 )(x−x1 )+. . .+an (x−x0 )(x−x1 ) . . . (x−xn−1 )

The interpolation conditions

Pn (x0 ) = y0 , Pn (x1 ) = y1 , ..., Pn (xn ) = yn

give rise to the following augmented matrix system for the coefficients a0 , a1 , . . . , an :
 
1 0 0 ... 0 y0
1 (x1 − x0 ) 0 ... 0 y1
 
 
 
 1 (x2 − x0 ) (x2 − x0 )(x2 − x1 ) ... 0 y2 
.. .. .. .. ..
 
1 . . . . .
 
 
1 (xn − x0 ) (xn − x0 )(xn − x1 ) . . . (xn − x0 ) . . . (xn − xn−1 ) yn
(4.5)
Using forward substitution to solve this lower triangular system, we ob-
tain
a0 = y0
y1 − y0
a1 =
x1 − x0

5
after which the expressions for the ai start to get quite complicated. We need
some notation to tidy things up.
Definition 4.3
The zeroth divided difference of f with respect to xi is denoted f [xi ] and
defined by
f [xi ] = yi .

Definition 4.4
The kth divided difference of f with respect to xi , xi+1 , . . . , xi+k is denoted
f [xi , xi+1 , . . . , xi+k ] and defined by

f [xi+1 , . . . , xi+k ] − f [xi , . . . , xi+k−1 ]


f [xi , xi+1 , . . . , xi+k ] =
xi+k − xi

With this notation, the solution to (4.5) can be written succinctly:

a0 = f [x0 ]
a1 = f [x0 , x1 ]
a2 = f [x0 , x1 , x2 ]
..
.
an = f [x0 , x1 , x2 , . . . , xn ]

and thus

Pn (x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + f [x0 , x1 , x2 ](x − x0 )(x − x1 ) + . . .


+ f [x0 , x1 , x2 , . . . , xn ](x − x0 )(x − x1 ) . . . (x − xn−1 )
n k−1
!
X Y
= f [x0 , x1 , . . . , xk ] (x − xi ) (4.6)
k=0 i=0

Definition 4.5
Given the distinct abscissas x0 , x1 , . . . , xn and function values y0 , y1, . . . , yn ,
the polynomial Pn defined by

n k−1
!
X Y
Pn (x) = f [x0 , x1 , . . . , xk ] (x − xi )
k=0 i=0

6
is called the Newton divided difference form of the interpolating
polynomial.

Example 4.5

(a) Find the Newton divided difference form of the interpolating polynomial
for the function f (x) = cos(x) and the abscissas x0 = 0, x1 = π/2,
x2 = π/6.

(b) Use the polynomial to estimate cos(π/3), and compare the value to that
obtained using the Lagrange form.

(c) With as little extra work as possible, include the abscissa x3 = π/4 and
recompute the estimate of cos(π/3).

Example 4.6

(a) Find the Newton divided difference form of the interpolating polynomial
for the following data:

i 0 1 2 3
xi 1.0 2.0 3.0 4.0
yi 0.0000 0.6931 1.0986 1.3863

(b) Use the polynomial to estimate the function at x = 2.5, and compare
the value to that obtained using the Lagrange form.

4.3 Newton forward difference form


In the case where the abscissas are equally spaced, we can derive a simpler
version of Newton divided differences, called Newton forward differences.

Definition 4.6
The forward difference operator ∆ is defined by

∆yi = yi+1 − yi

7
Higher order forward differences are defined by repeated application. For
example,

∆2 yi = ∆(∆yi ) = ∆(yi+1 − yi) = ∆yi+1 − ∆yi


= yi+2 − 2yi+1 + yi
∆ yi = ∆(∆2 yi ) = ∆(yi+2 − 2yi+1 + yi ) = ∆yi+2 − 2∆yi+1 + ∆yi
3

= yi+3 − 3yi+2 + 3yi+1 − yi


etc.

Theorem 4.4 Given the equally-spaced abscissas x0 , x1 , . . . , xn and func-


tion values y0 , y1, . . . , yn , the divided difference notation and the forward
difference notation are related by

∆k y0
f [x0 , x1 , . . . , xk ] = ,
k!hk
where h = xi+1 − xi is the spacing between the abscissas.
Using Theorem 4.4, and making the substitution x = x0 + sh in (4.6), we
obtain
s(s − 1) 2 s(s − 1)(s − 2) . . . (s − n + 1) n
Pn (x) = y0 + s∆y0 + ∆ y0 + . . . + ∆ y0
2 n!
n  
X s
= ∆k y0
k=0
k

which expresses Pn (x) in terms of the new variable s = (x − x0 )/h.


Note: the symbol ks is called the binomial coefficient, and defined as


 
s s(s − 1)(s − 2) . . . (s − k + 1)
= .
k k!

Definition 4.7
Given the equally-spaced abscissas x0 , x1 , . . . , xn and function values y0 , y1 , . . . , yn ,
the polynomial Pn defined by
n  
X s
Pn (x) = ∆k y0
k=0
k

8
where s = (x − x0 )/h and h = xi+1 − xi is called the Newton forward
difference form of the interpolating polynomial.

Substituting x = x0 +sh in (4.4) yields the Newton forward difference


form of the remainder term:

f (n+1) (c)
Rn (x) = s(s − 1)(s − 2) . . . (s − n)hn+1 .
(n + 1)!

Example 4.7

(a) Find the Newton forward difference form of the interpolating polynomial
for the following data:

i 0 1 2 3
xi 1.0 2.0 3.0 4.0
yi 0.0000 0.6931 1.0986 1.3863

(b) Use the polynomial to estimate the function at x = 2.5, and compare
the value to that obtained using the divided difference form.

Example 4.8

(a) Find the Newton forward difference form of the interpolating polynomial
through the following points: (0, 1), (0.5, 1.6487), (1, 2.7183).

(b) Given that these data come from the function f (x) = ex , find an upper

bound on the error incurred when using this polynomial to estimate 3 e.

(c) Use the polynomial to estimate 3 e, and compare the error in the ap-
proximation to the theoretical bound.

(d) Include the points (1.5, 4.4817), (2, 7.3891), and repeat (b) and (c).

9
4.4 Exercises
1. (a) Find the Lagrange form of the interpolating polynomial for the func-
1
tion f (x) = 1+x and the abscissas x0 = 0, x1 = 2, x2 = 3, x3 = 4.
(b) Find an upper bound on the error incurred when using this polyno-
mial to estimate f (1).
(c) Use the polynomial to estimate f (1), and compare the error in the
approximation to the theoretical bound.

2. Find the Lagrange form of the interpolating polynomial through the fol-
lowing points: (0.30, sin 0.30), (0.32, sin 0.32), (0.35, sin 0.35). Estimate
sin 0.34 and determine an error bound for the approximation.

3. (a) Find the Newton divided difference form of the interpolating poly-
1
nomial for the function f (x) = 1+x and the abscissas x0 = 0, x1 = 2,
x2 = 3, x3 = 4.
(b) Use the polynomial to estimate f (1), and compare your answer to
that of 1(c).
(c) Find an upper bound on the error incurred when using this polyno-
mial to estimate f (5).
(d) Use the polynomial to estimate f (5), and compare the error in the
approximation to the theoretical bound.

4. Consider the following data:


x 0.1 0.3 0.7 0.9 1.1 1.3
f (x) 0.003 0.067 0.248 0.370 0.518 0.697

(a) Use the first two entries to construct the interpolating polynomial of
degree one.
(b) Include the next two entries to construct the interpolating polynomial
of degree three.
(c) Include the next two entries to construct the interpolating polynomial
of degree five.

10
(d) Estimate f (0.5) in each case.

5. Consider the following data:


x 0.7 0.9 0.3 1.1 0.1 1.3
f (x) 0.248 0.370 0.067 0.518 0.003 0.697

(a) Use the first two entries to construct the interpolating polynomial of
degree one.
(b) Include the next two entries to construct the interpolating polynomial
of degree three.
(c) Include the next two entries to construct the interpolating polynomial
of degree five.
(d) Estimate f (0.5) in each case.

6. (a) Find the Newton forward difference form of the interpolating poly-
1
nomial for the function f (x) = 1+x and the abscissas x0 = 0, x1 = 1,
x2 = 2, x3 = 3.
(b) Find an upper bound on the error incurred when using this polyno-
mial to estimate f (2.5).
(c) Use the polynomial to estimate f (2.5), and compare the error in the
approximation to the theoretical bound.
(d) Find an upper bound on the error incurred when using this polyno-
mial to estimate f (5).
(e) Use the polynomial to estimate f (5), and compare the error in the
approximation to the theoretical bound.

7. Consider the following data:


x 0.0 0.2 0.4 0.6 0.8
f (x) 1.00000 1.22140 1.49182 1.82212 2.22554

(a) Use the first three entries to construct the interpolating polynomial
of degree two.

11
(b) Include the next two entries to construct the interpolating polynomial
of degree four.
(c) Estimate f (1.0) in each case.

8. The following table shows the population of a city at the beginning of the
six previous decades:
Year 1950 1960 1970 1980 1990 2000
Population 173 253 181 719 200 747 229 373 253 262 276 555
Use the interpolating polynomial to estimate the population in 2010.

12

You might also like