Lecture PDF
Lecture PDF
Joe Mahaffy,
[email protected]
Department of Mathematics
Dynamical Systems Group
Computational Sciences Research Center
San Diego State University
San Diego, CA 92182-7720
http://www-rohan.sdsu.edu/jmahaffy
Spring 2010
Joe Mahaffy, [email protected] #5 Interpolation and Polynomial Approximation (1/41)
Polynomial Approximation: Practical Computations
Polynomial Approximation, Higher Order Matching
Beyond Hermite Interpolatory Polynomials
Outline
Previously:
Nevilles Method to successively generate higher degree polynomial ap-
proximations at a specific point. If we need to compute the polyno-
mial at many points, we have to re-run Nevilles method for each point.
O(n2 ) operations/point.
Next:
Use divided differences to generate the polynomials themselves.
The coefficients of the polynomials. Once we have those, we can
quickly (remember Horners method?) compute the polynomial in
any desired points. O(n) operations/point.
Representing Polynomials
If Pn (x) is the nth degree polynomial that agrees with f (x) at the
points {x0 , x1 , . . . , xn }, then we can (for the appropriate constants
{a0 , a1 , . . . , an }) write:
Pn (x) = a0 + a1 (x x0 ) + a2 (x x0 )(x x1 ) +
+ an (x x0 )(x x1 ) (x xn1 )
Representing Polynomials
If Pn (x) is the nth degree polynomial that agrees with f (x) at the
points {x0 , x1 , . . . , xn }, then we can (for the appropriate constants
{a0 , a1 , . . . , an }) write:
Pn (x) = a0 + a1 (x x0 ) + a2 (x x0 )(x x1 ) +
+ an (x x0 )(x x1 ) (x xn1 )
at x0 : a0 = Pn (x0 ) = f (x0 ).
k th Divided Difference:
f [xi+1 , xi+2 , . . . , xi+k ] f [xi , xi+1 , . . . , xi+k1 ]
f [xi , xi+1 , . . . , xi+k ] = .
xi+k xi
We had
at x0 : a0 = Pn (x0 ) = f (x0 ).
f [x1 , x2 ] f [x0 , x1 ]
= = f[x0 , x1 , x2 ] (!!!)
x2 x 0 x2 x 0
Pn (x) = f [x0 ] +
f [x0 , x1 ](x x0 ) +
f [x0 , x1 , x2 ](x x0 )(x x1 ) +
f [x0 , x1 , x2 , x3 ](x x0 )(x x1 )(x x2 ) +
f (n) ()
f [x0 , . . . , xn ] = .
n!
h = xi+1 xi , i = 0, . . . , n 1,
where
s s(s + 1) (s + k 1)
= (1)k .
k k!
The Newton formulas works best for points close to the edge of
the table; if we want to approximate f (x) close to the center, we
have to work some more...
x f (x) 1st Div. Diff. 2nd Div. Diff. 3rd Div. Diff. 4th Div. Diff.
x2 f [x2 ]
f [x2 , x1 ]
x1 f [x1 ] f [x2 , x1 , x0 ]
f[x1 , x0 ] f[x2 , x1 , x0 , x1 ]
x0 f[x0 ] f[x1 , x0 , x1 ] f[x2 , x1 , x0 , x1 , x2 ]
f[x0 , x1 ] f[x1 , x0 , x1 , x2 ]
x1 f [x1 ] f [x0 , x1 , x2 ] f [x1 , x0 , x1 , x2 , x3 ]
f [x1 , x2 ] f [x0 , x1 , x2 , x3 ]
x2 f [x2 ] f [x1 , x2 , x3 ]
f [x2 , x3 ]
x3 f [x3 ]
where h i
Hn,j (x) = 1 2(x xj )Ln,j (xj ) L2n,j (x)
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
0, if i 6= j
Recall: Ln,j (xi ) = i,j =
1 if i = j
(i,j is Kroneckers delta).
(x): H (x ) = 0 when i 6= j.
Since Ln,j (x) is a factor in Hn,j n,j i
Proof, continued...
(x )
Hn,j j = [2Ln,j (xj )] L2n,j (xj )
| {z }
1
+ [1 2 (xj xj ) Ln,j (xj )] 2 Ln,j (xj ) Ln,j (xj )
| {z } | {z }
0 1
= 2Ln,j (xj ) + 1 2 Ln,j (xj ) = 0
Proof, continued...
(x )
Hn,j j = [2Ln,j (xj )] L2n,j (xj )
| {z }
1
+ [1 2 (xj xj ) Ln,j (xj )] 2 Ln,j (xj ) Ln,j (xj )
| {z } | {z }
0 1
= 2Ln,j (xj ) + 1 2 Ln,j (xj ) = 0
Proof, continued...
(x )
Hn,j j = [2Ln,j (xj )] L2n,j (xj )
| {z }
1
+ [1 2 (xj xj ) Ln,j (xj )] 2 Ln,j (xj ) Ln,j (xj )
| {z } | {z }
0 1
= 2Ln,j (xj ) + 1 2 Ln,j (xj ) = 0
(x)
Hn,j = L2n,j (x) + 2(x xj )Ln,j (x)Ln,j (x)
h i
= Ln,j (x) Ln,j (x) + 2(x xj )Ln,j (x)
Proof, continued...
(x )
Hn,j j = [2Ln,j (xj )] L2n,j (xj )
| {z }
1
+ [1 2 (xj xj ) Ln,j (xj )] 2 Ln,j (xj ) Ln,j (xj )
| {z } | {z }
0 1
= 2Ln,j (xj ) + 1 2 Ln,j (xj ) = 0
(x)
Hn,j = L2n,j (x) + 2(x xj )Ln,j (x)Ln,j (x)
h i
= Ln,j (x) Ln,j (x) + 2(x xj )Ln,j (x)
(x ) = 0, since L (x ) = .
If i 6= j: Hn,j i n,j i i,j
h i
If i = j: Hn,j (xj ) = 1 1 + 2(xj xj )Ln,j (xj ) = 1.
Proof, continued...
(x )
Hn,j j = [2Ln,j (xj )] L2n,j (xj )
| {z }
1
+ [1 2 (xj xj ) Ln,j (xj )] 2 Ln,j (xj ) Ln,j (xj )
| {z } | {z }
0 1
= 2Ln,j (xj ) + 1 2 Ln,j (xj ) = 0
(x)
Hn,j = L2n,j (x) + 2(x xj )Ln,j (x)Ln,j (x)
h i
= Ln,j (x) Ln,j (x) + 2(x xj )Ln,j (x)
(x ) = 0, since L (x ) = .
If i 6= j: Hn,j i n,j i i,j
h i
If i = j: Hn,j (xj ) = 1 1 + 2(xj xj )Ln,j (xj ) = 1.
Uniqueness Proof
Uniqueness Proof
Uniqueness Proof
Uniqueness Proof
Uniqueness Proof
Uniqueness Proof
However, there is good news: we can re-use the algorithm for Newtons
Interpolatory Divided Difference Formula with some modifications in
the initialization.
We double the number of points, i.e. let
Set up the divided difference table (up to the first divided differences),
and let 0 (formally), and identify:
f [xi + ] f [xi ]
f (xi ) = lim ,
0
y f(x) 1st Div. Diff. 2nd Div. Diff. 3rd Div. Diff.
y0 = x0 f [y0 ]
f [y0 , y1 ] = f (y 0)
y1 = x0 f [y1 ] f [y0 , y1 , y2 ]
f [y1 , y2 ] f [y0 , y1 , y2 , y3 ]
y2 = x1 f [y2 ] f [y1 , y2 , y3 ]
f [y2 , y3 ] = f (y 2) f [y1 , y2 , y3 , y4 ]
y3 = x1 f [y3 ] f [y2 , y3 , y4 ]
f [y3 , y4 ] f [y2 , y3 , y4 , y5 ]
y4 = x2 f [y4 ] f [y3 , y4 , y5 ]
f [y4 , y5 ] = f (y4 ) f [y3 , y4 , y5 , y6 ]
y5 = x2 f [y5 ] f [y4 , y5 , y6 ]
f [y5 , y6 ] f [y4 , y5 , y6 , y7 ]
y6 = x3 f [y6 ] f [y5 , y6 , y7 ]
f [y6 , y7 ] = f (y 6) f [y5 , y6 , y7 , y8 ]
y7 = x3 f [y7 ] f [y6 , y7 , y8 ]
f [y7 , y8 ] f [y6 , y7 , y8 , y9 ]
y8 = x4 f [y8 ] f [y7 , y8 , y9 ]
f [y8 , y9 ] = f (y 8)
y9 = x4 f [y9 ]
H3 (x) revisited...
Old notation
h ih i2 h ih i2
H3 (x) = 1 + 2 xxx
1 x
0
0
x1 x
x1 x 0
f (x0 ) + 1 + 2 x1 x
x1 x 0
xx0
x1 x0
f (x1 )
h i2 h i2
+ (x x0 ) xx11x
x
0
f (x0 ) + (x x1 ) xxx 0
1 x0
f (x1 ).
H3 (x) Example
0
0 0.2 0.4 0.6 0.8 1
x0 = 0, x1 = 1
f (x0 ) = 0, f (x0 ) = 4, f (x1 ) = 3, f (x1 ) = 1
H3 (x) = 4x x 2 3x 2 (x 1)
Joe Mahaffy, [email protected] #5 Interpolation and Polynomial Approximation (32/41)
Polynomial Approximation: Practical Computations Osculating Polynomials
Polynomial Approximation, Higher Order Matching Hermite Interpolatory Polynomials
Beyond Hermite Interpolatory Polynomials Computing Hermite Interpolatory Polynomials
Example
x0 = 0; x1 = 1; % This is the data
fv0 = 0; fpv0 = 4;
fv1 = 3; fpv1 = -1;
y0 = x0; f0=fv0; % Initializing the table
y1 = x0; f1=fv0;
y2 = x1; f2=fv1;
y3 = x1; f3=fv1;
f01 = fpv0; % First divided differences
f12 = (f2-f1)/(y2-y1);
f23 = fpv1;
f012 = (f12-f01)/(y2-y0); % Second divided differences
f123 = (f23-f12)/(y3-y1);
f0123 = (f123-f012)/(y3-y0); % Third divided difference
x=(0:0.01:1);
H3 = f0 + f01*(x-y0) + f012*(x-y0).*(x-y1) + ...
f0123*(x-y0).*(x-y1).* (x-y2);
On the next slide we see the setup for two point in which two
derivatives are prescribed.
y f(x) 1st Div. Diff. 2nd Div. Diff. 3rd Div. Diff.
y0 = x0 f [y0 ]
f [y0 , y1 ] = f (x 0)
y1 = x0 f [y1 ] f [y0 , y1 , y2 ] = 12 f (x0 )
f [y1 , y2 ] = f (x 0) f [y0 , y1 , y2 , y3 ]
y2 = x0 f [y2 ] f [y1 , y2 , y3 ]
f [y2 , y3 ] f [y1 , y2 , y3 , y4 ]
y3 = x1 f [y3 ] f [y2 , y3 , y4 ]
f [y3 , y4 ] = f (x 1) f [y2 , y3 , y4 , y5 ]
y4 = x1 f [y4 ] f [y3 , y4 , y5 ] = 12 f (x1 )
f [y4 , y5 ] = f (x 1)
y5 = x1 f [y5 ]
Examples...
Osculating Polynomials
0.2
0.2
0.4
f(1) = +1.00
0.6
df(1) = +1.00
0.8 ddf(1) = +0.00
Examples...
Osculating Polynomials
0.2
0.2
0.4
f(1) = +1.00
0.6
df(1) = +1.00
0.8 ddf(1) = +0.00
Examples...
Osculating Polynomials
Examples...
Osculating Polynomials
0.2
0.2
0.4
f(1) = +1.00
0.6
df(1) = 1.00
0.8 ddf(1) = 10.00
Examples...
Osculating Polynomials Osculating Polynomials
1 1
0.8 f(0) = +0.00 f(1) = 1.00 0.8 f(0) = +0.00 f(1) = 1.00
df(0) = +1.00 df(1) = 1.00 df(0) = 1.00 df(1) = 1.00
0.6 0.6
ddf(0) = +0.00 ddf(1) = +0.00 ddf(0) = +0.00 ddf(1) = +0.00
0.4 0.4
0.2 0.2
0 0
0.2 0.2
0.4 0.4
f(1) = +1.00 f(1) = +1.00
0.6 0.6
df(1) = +1.00 df(1) = +1.00
0.8 ddf(1) = +0.00 0.8 ddf(1) = +0.00
1 1
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1 1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
Osculating Polynomials Osculating Polynomials
0
0.2
0.4
f(1) = +1.00
0.5 f(1) = +1.00 0.6
df(1) = 1.00
df(1) = +2.00
ddf(1) = 1.00 0.8 ddf(1) = 10.00
1 1
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1 1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
The class website contains links to short bios for these (and other)
mathematicians, click on Mathematics Personae, who have contributed
to the material covered in this class. It makes for interesting reading and
puts mathematics into a historical and political context.