Polynomial Interpolation: Math 128A Spring 2002 Handout # 9 Sergey Fomel February 19, 2002
Polynomial Interpolation: Math 128A Spring 2002 Handout # 9 Sergey Fomel February 19, 2002
Example Function
1
f (x) = .
x
0.8
0.6
0.4
0.2
1 2 3 4 5 6
We select three nodes and find the interpolating polynomial for them.
x 2 4 5
f 0.5 0.25 0.2
The second-order interpolation polynomial does not reconstruct the function exactly but fits the
input data.
1
1
True
0.8
Interpolation
0.6
0.4
0.2
1 2 3 4 5 6
Lagrange Interpolation
where Y x − xi
L k (x) = .
xk − xi
i6=k
In our example,
(x − 4) (x − 5) (x − 4) (x − 5)
L 1 (x) = =
(2 − 4) (2 − 5) 6
(x − 2) (x − 5) (x − 2) (x − 5)
L 2 (x) = =−
(4 − 2) (4 − 5) 2
(x − 2) (x − 4) (x − 2) (x − 4)
L 3 (x) = =
(5 − 2) (5 − 4) 3
2
Lagrange Polynomials
L2
L1 L3
2
-1
-2
1 2 3 4 5 6
L 1 (x) is one at x1 = 2 and zero at x2 = 4 and x3 = 5. Likewise, L 2 (x) is one at x2 and zero at x1
and x3 . L 3 (x) is one at x3 and zero at x1 and x2 .
Putting it all together,
(x − 4) (x − 5) (x − 2) (x − 5) (x − 2) (x − 4)
P(x) = − + = 0.025 x 2 − 0.275 x + 0.95 .
12 8 15
Lagrange Interpolation
0.8
0.6
0.4
0.2
1 2 3 4 5 6
Newton Interpolation
3
where
k−1
Y
Nk (x) = (x − xi ) ,
i=1
and f [x1 x2 , . . . , xk ] is the divided difference, evaluated with the help of the recursive relationship
f [xk ] = fk
f [x2 , . . . , xk ] − f [x1 . . . , xk−1 ]
f [x1 x2 , . . . , xk ] =
xk − x1
In our example,
N1 (x) = 1
N2 (x) = x − 2
N3 (x) = (x − 2) (x − 4)
Newton Polynomials
8
6 N3
N2
4 N1
1 2 3 4 5 6
f [x1 ] = 0.5
0.25−0.5
f [x2 ] = 0.25 f [x1 , x2 ] = 4−2 = −0.125
0.2−0.25 −0.05+0.125
f [x3 ] = 0.2 f [x2 , x3 ] = 5−4 = −0.05 f [x1 , x2 , x3 ] = 5−2 = 0.025
1 x − 2 (x − 2) (x − 4)
P(x) = − + = 0.025 x 2 − 0.275 x + 0.95 .
2 8 40
4
Newton Interpolation
0.8
0.6
0.4
0.2
1 2 3 4 5 6
Neville Interpolation
P0 (x) = f1
Pk−2 (x) (xk − x) − Q k−2 (x) (x − x1 )
Pk−1 (x) = ,
xk − x1
where Pk−1 (x) interpolates at nodes x1 , x2 , . . . , xk , and Q k−2 (x) interpolates at nodes x2 , . . . , xk .
The zeroth-order Neville polynomials are constant functions.
Neville Polynomials, Order 0
0.8
0.6
0.4
0.2
1 2 3 4 5 6
5
The first-order Neville polynomials are
1 1
2 (4 − x) + 4 (x − 2) 6−x
P1 (x) = =
4−2 8
1 1
4 (5 − x) + 5 (x − 4) 9−x
Q 1 (x) = =
5−4 20
Neville Polynomials, Order 1
0.8
0.6
0.4
0.2
1 2 3 4 5 6
0.8
0.6
0.4
0.2
1 2 3 4 5 6