Interpolation and Its Characters
Interpolation and Its Characters
y = cos(x)
y = p (x)
2
x
π/4 π/2
PURPOSES OF INTERPOLATION
p(x) = a0 + a1 e x + a2 e 2x + · · · + an e nx
(x1,y1)
(x0,y0)
x
LINEAR INTERPOLATION
x − x1 x − x0 (x1 − x) y0 + (x − x0 ) y1
P1 (x) = y0 + y1 =
x0 − x1 x1 − x0 x1 − x0
x − x0 y1 − y0
= y0 + (y1 − y0 ) = y0 + (x − x0 )
x1 − x0 x1 − x0
x0 = 1.1, x1 = 1.2
y=tan(x)
1 1.3 x
y = tan(x)
y = p1(x)
x
1.1 1.2
QUADRATIC INTERPOLATION
We want to find a polynomial
P2 (x) = a0 + a1 x + a2 x 2
which satisfies
P2 (xi ) = yi , i = 0, 1, 2
for given data points (x0 , y0 ), (x1 , y1 ), (x2 , y2 ). One formula for
such a polynomial is
with
(x−x1 )(x−x2 ) (x−x0 )(x−x2 )
L0 (x) = (x0 −x1 )(x0 −x2 ) , L1 (x) = (x1 −x0 )(x1 −x2 )
(x−x0 )(x−x1 )
L2 (x) = (x2 −x0 )(x2 −x1 )
deg(Pn ) ≤ n, Pn (xi ) = yi , i = 0, 1, · · · , n
EXAMPLE
Recall the table
x 1 1.1 1.2 1.3
tan x 1.5574 1.9648 2.5722 3.6021
We now interpolate this table with the nodes
x0 = 1, x1 = 1.1, x2 = 1.2, x3 = 1.3
Without giving the details of the evaluation process, we have the
following results for interpolation with degrees n = 1, 2, 3:
n 1 2 3
Pn (1.15) 2.2685 2.2435 2.2296
Error −.0340 −.0090 .0049
The accuracy improves with increasing degree n, but not at a very
rapid rate. In fact, the error becomes worse when n is increased
further (for this particular function tan x). Later we will see that
interpolation of a much higher degree, say n ≥ 10, is often poorly
behaved when the node points {xi } are evenly spaced.
A FIRST ORDER DIVIDED DIFFERENCE
For a given function f (x) and two distinct points x0 and x1 , define
f (x1 ) − f (x0 )
f [x0 , x1 ] =
x1 − x0
This is called a first order divided difference of f (x).
By the mean-value theorem,
f (x1 ) − f (x0 ) = f 0 (c) (x1 − x0 )
for some c between x0 and x1 . Thus
f [x0 , x1 ] = f 0 (c)
and the divided difference in very much like the derivative,
especially if x0 and x1 are quite close together. In fact,
0 x1 + x0
f ≈ f [x0 , x1 ]
2
is quite an accurate approximation of the derivative (see §5.4).
SECOND ORDER DIVIDED DIFFERENCES
Given three distinct points x0 , x1 , and x2 , define
f [x1 , x2 ] − f [x0 , x1 ]
f [x0 , x1 , x2 ] =
x2 − x0
This is called the second order divided difference of f (x).
By a fairly complicated argument, we can show
1
f [x0 , x1 , x2 ] = f 00 (c)
2
for some c intermediate to x0 , x1 , and x2 . In fact, as we
investigate in §5.4,
x1 − x0 = x2 − x1
EXAMPLE
x 1 1.1 1.2 1.3 1.4
cos x .54030 .45360 .36236 .26750 .16997
Let x0 = 1, x1 = 1.1, and x2 = 1.2. Then
.45360 − .54030
f [x0 , x1 ] = = −.86700
1.1 − 1
.36236 − .45360
f [x1 , x2 ] = = −.91240
1.2 − 1.1
f [x1 , x2 ] − f [x0 , x1 ]
f [x0 , x1 , x2 ] =
x2 − x0
−.91240 − (−.86700)
= = −.22700
1.2 − 1.0
For comparison,
0 x1 + x0
f = − sin (1.05) = −.86742
2
1 00 1
f (x1 ) = − cos (1.1) = −.22680
2 2
GENERAL DIVIDED DIFFERENCES
What happens when some of the nodes {x0 , ..., xn } are not
distinct. Begin by investigating what happens when they all come
together as a single point x0 .
For first order divided differences, we have
f (x1 ) − f (x0 )
lim f [x0 , x1 ] = lim = f 0 (x0 )
x1 →x0 x1 →x0 x1 − x0
We extend the definition of f [x0 , x1 ] to coincident nodes using
f [x0 , x0 ] = f 0 (x0 )
For second order divided differences, recall
1
f [x0 , x1 , x2 ] = f 00 (c)
2
with c intermediate to x0 , x1 , and x2 .
Then as x1 → x0 and x2 → x0 , we must also have that c → x0 .
Therefore,
1
lim f [x0 , x1 , x2 ] = f 00 (x0 )
x1 →x0
x →x
2
2 0
We therefore define
1
f [x0 , x0 , x0 ] = f 00 (x0 )
2
For the case of general f [x0 , ..., xn ], recall that
1 (n)
f [x0 , ..., xn ] = f (c)
n!
for some c intermediate to {x0 , ..., xn }. Then
1 (n)
lim f [x0 , ..., xn ] = f (x0 )
{x1,...,xn }→x0 n!
and we define
1
f [x0 , ..., x0 ] = f (n) (x0 )
| {z } n!
n+1 times
with {L0 (x), ..., Ln (x)} the Lagrange basis polynomials. Each Lj is
of degree n and
1, j = i,
Lj (xi ) = 0 ≤ i, j ≤ n.
0, j 6= i,
THE NEWTON DIVIDED DIFFERENCE FORM
Let the data values be
(xi , f (xi )) , i = 0, 1, · · · , n
we have
in which Pn−1 (x) interpolates f (x) at the points in {x0 , ..., xn−1 }.
The Newton Form vs. Taylor Poly
can be written as