Professional Documents
Culture Documents
Interpolation (Part I) : Simon Fraser University - Surrey Campus MACM 316 - Spring 2005 Instructor: Ha Le
Interpolation (Part I) : Simon Fraser University - Surrey Campus MACM 316 - Spring 2005 Instructor: Ha Le
Interpolation (Part I)
& %
1
' $
Overview
• Polynomial interpolation
• The basic theorem
• Lagrange form, Neville’s method
• Divided-difference method
• Hermite interpolation
• Piecewise polynomial interpolation
• Cubic spline interpolation
• Planar parametric curves
& %
2
' $
& %
3
' $
Interpolation: an Example
1 11 3 3 7 5 9 11 7
S= (0, 1), , 1 , 1, , , , 2, , , , 3, , ,1
2 10 2 4 8 2 10 10 2
1.4
1.2
0.8
0.6
0 1 2 3 4
z
& %
4
' $
Polynomial Interpolation
& %
5
' $
& %
6
' $
In matrix/vector notation:
2 3
1 x 0 x0 x0 c0 y0
1 x x 2 x 3 c y
1 1 1 1 1
·
=
1 x 2 x2 2 x2 3 c2 y 2
1 x 3 x3 2 x3 3 c3 y3
| {z } | {z } | {z }
Vandermonde matrix: V c y
Y
det V = (xi − xj ) =
i<j
since xi 6= xj for i 6= j.
& %
7
' $
& %
8
' $
Lagrange Form
i 0 1 2 3 4
xi 3.2 2.7 1.0 4.8 5.6
P (xi ) 22.0 17.8 14.2 38.3 51.7
Use x0 , x1 , and x2 to construct the second Lagrange interpolating
polynomial.
(x − x1 )(x − x2 ) (x − x0 )(x − x2 )
P0,1,2 (x) = P (x0 ) + P (x1 ) +
(x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 )
(x − x0 )(x − x1 )
P (x2 )
(x2 − x0 )(x2 − x1 )
≈ 20.0 (x − 2.7) (x − 1.0) − 20.9 (x − 3.2) (x − 1.0) +
3.80 (x − 3.2) (x − 2.7) .
& %
10
' $
which approximates
& %
11
' $
Note. The error form for the Lagrange polynomial is quite similar
to that for the Taylor polynomial.
& %
12
' $
Neville’s Method
& %
13
' $
& %
14
' $
P0
P0,1
P1 P0,1,2
P1,2 P0,1,2,3
P2 P1,2,3 P0,1,2,3,4
P2,3 P1,2,3,4
P3 P2,3,4
P3,4
P4
(x − x1 )P0 − (x − x0 )P1
Example. P0,1 (x) = is derived from P0
x0 − x 1
and P1 . Similarly, P0,1,2,3 can be derived from P0,1,2 and P1,2,3 .
& %
15
' $
& %
16
' $
Divided-Difference Method
Let S = {(x0 , f (x0 )), (x1 , f (x1 )), . . . , (xn , f (xn ))}, xi 6= xj for
i 6= j. Consider
Pn (x) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 ) + · · · +
an (x − x0 )(x − x1 ) · · · (x − xn−1 ).
& %
17
' $
& %
18
' $
First Second
x f (x) divided differences divided differences
x0 f [x0 ]
f [x1 ]−f [x0 ]
f [x0 , x1 ] = x1 −x0
f [x1 ,x2 ]−f [x0 ,x1 ]
x1 f [x1 ] f [x0 , x1 , x2 ] = x2 −x0
f [x2 ]−f [x1 ]
f [x1 , x2 ] = x2 −x1
f [x2 ,x3 ]−f [x1 ,x2 ]
x2 f [x2 ] f [x1 , x2 , x3 ] = x3 −x1
f [x3 ]−f [x2 ]
f [x2 , x3 ] = x3 −x2
x3 f [x3 ]
& %
19
' $
Pn (x) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 ) + · · · +
an (x − x0 )(x − x1 ) · · · (x − xn−1 ). (5)
Pn (x0 ) = f (x0 ) = f [x0 ] = a0 .
Pn (x1 ) = f (x1 ) = f [x1 ] = f [x0 ] + a1 (x − x0 ). Hence,
f [x1 ] − f [x0 ]
a1 = = f [x0 , x1 ].
x1 − x 0
ak = f [x0 , x1 , . . . , xk ].
n
X
By (5), Pn (x) = f [x0 ] + f [x0 , x1 , . . . , xk ](x − x0 ) · · · (x − xk−1 ) =
k=1
22
' $
Foward-difference operator.
∆f (xi ) = f (xi+1 )−f (xi ), ∆k f (xi ) = ∆k−1 (∆f (xi )) for k = 2, 3, . . . .
f (x1 ) − f (x0 ) ∆f (x0 )
f [x0 , x1 ] = = .
x1 − x 0 h
f [x1 , x2 ] − f [x0 , x1 ] 1 ∆f (x1 ) − ∆f (x0 )
f [x0 , x1 , x2 ] = =
x2 − x 0 2h h
1 1 2
= (∆(f (x 1 ) − f (x 0 ))) = ∆ f (x0 ).
2h2 2! h2
1 k
In general, f [x0 , x1 , . . . , xk ] = ∆ f (x0 ). Hence,
k! hk
n
X s
Pn (x) = f [x0 ] + k! hk f [x0 , x1 , . . . , xk ]
k
k=1
n
X s
= f [x0 ] + ∆k f (x0 ).
k
& %
k=1
23
' $
Hermite Interpolation
P (xi ) = f (xi ),
P 0 (xi ) = f 0 (xi ).
& %
24
' $
Hermite Polynomials
where
Hj (x) = 1 − 2(x − xj )L0j (xj ) L2j (x), H̄j (x) = (x − xj )L2j (x).
Moreover, if f ∈ C 2n+2 [a, b], then for some ξ with a < ξ < b,
(x − x0 )2 · · · (x − xn )2 (2n+2)
f (x) = H(x) + f (ξ).
(2n + 2)!
& %
25
' $
j xj f (xj ) f 0 (xj )
0 1.3 0.6200860 -0.5220232
1 1.6 0.4554022 -0.5698959
2 1.9 0.2818186 -0.5811571
2
X 2
X
H(x) = f (xj )Hj (x) + f 0 (xj )Ĥj (x)
j=0 j=0
& %
26
' $
H0 (x) = (1−2(x−x0 )L00 (x0 )) L20 (x), Ĥ0 (x) = (x−x0 )L20 (x)
H1 (x) = (1−2(x−x1 )L01 (x1 )) L21 (x), Ĥ1 (x) = (x−x1 )L21 (x)
H2 (x) = (1−2(x−x2 )L02 (x2 )) L22 (x), Ĥ2 (x) = (x−x2 )L22 (x)
& %
27
' $
A small table:
First Second
x f (x) divided differences divided differences
z0 = x 0 f [z0 ] = f (x0 )
f [z0 , z1 ] = f 0 (x0 )
f [z1 ,z2 ]−f [z0 ,z1 ]
z1 = x 0 f [z1 ] = f (x0 ) f [z0 , z1 , z2 ] =
z2 −z0
f [z2 ]−f [z1 ]
f [z1 , z2 ] =
z2 −z1
f [z2 ,z3 ]−f [z1 ,z2 ]
z2 = x 1 f [z2 ] = f (x1 ) f [z1 , z2 , z3 ] =
z3 −z1
f [z2 , z3 ] = f 0 (x1 )
z3 = x 1 f [z3 ] = f (x1 )
& %
29
' $
& %
30
' $
f [z0 ,z1 ]
1.3 0.6200860 −0.0897427
f [z0 ,z1 ,z2 ]
−0.5489460 0.0663657
f [z1 ,z2 ] f [z0 ,z1 ,z2 ,z3 ]
1.6 0.4554022 −0.0698330 0.0026663
f [z1 ,z2 ,z3 ]
−0.5698959 0.0679655 -0.0027738
f [z4 ,z5 ]
1.9 0.2818186
& %
31