Interpolation
Interpolation
Interpolation
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 .
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.
1
4.1 Lagrange form
(Bradie, Section 5.1)
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
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.
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
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)
Pn (x) = a0 +a1 (x−x0 )+a2 (x−x0 )(x−x1 )+. . .+an (x−x0 )(x−x1 ) . . . (x−xn−1 )
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
a0 = f [x0 ]
a1 = f [x0 , x1 ]
a2 = f [x0 , x1 , x2 ]
..
.
an = f [x0 , x1 , x2 , . . . , xn ]
and thus
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.
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,
∆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
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.
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.
(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.
(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.
(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