Professional Documents
Culture Documents
3 Interpolation
3 Interpolation
3 Interpolation
Introduction to Interpolation
Introduction
Interpolation Problem
Existence and Uniqueness
Linear and Quadratic Interpolation
Newton’s Divided Difference Method
Properties of Divided Differences
2
Introduction
Interpolation was used for x sin(x)
long time to provide an
0 0.0000
estimate of a tabulated
function at values that are 0.1 0.0998
not available in the table.
0.2 0.1987
4
Example
Temperature Viscosity
An experiment is used to determine (degree)
the viscosity of water as a function
of temperature. The following table
0 1.792
is generated:
5 1.519
10 1.308
Problem: Estimate the viscosity
when the temperature is 8 degrees.
15 1.140
5
Interpolation (Unequal Intervals)
Lagrangian Formula
Pn ( x ) l0 ( x ) f 0 l1 ( x ) f1 .......... ln ( x) f n
58
Lagrange Interpolation
Problem: xi x0 x1 …. xn
Given
yi y0 y1 …. yn
f n ( xi ) f ( xi ) for i 0,1,..., n
n
Lagrange Interpolation Formula: Pn ( x) f xi i ( x)
i 0
i ( x)
n x xj
j 0 , j i xi x j
59
Lagrange Interpolation
( x) ( x x0 )( x x1 )....( x xi 1 )( x xi 1 )....( x xn )
i
60
Lagrange Interpolation Example
P2 ( x) f ( x0 ) 0 ( x) f ( x1 ) 1 ( x) f ( x2 ) 2 ( x) x 1/3 1/4 1
x x1 x x2 x 1 / 4 x 1 y 2 -1 7
0 ( x)
x0 x1 x0 x2 1 / 3 1 / 4 1 / 3 1 n
1 ( x)
x x0 x x2 x 1 / 3 x 1 Pn ( x) f xi i ( x)
x1 x0 x1 x2 1 / 4 1 / 3 1 / 4 1 i 0
n x x j
2 ( x)
x x0 x x1 x 1 / 3 x 1 / 4 i ( x) x x
x2 x0 x2 x1 1 1 / 3 1 1 / 4 j 0, j i i j
61
Lagrange Interpolation
In the case of high order polynomials
f (x)
x
62
10th Order Polynomial Interpolation
2
0.5
true function
-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
63
Divided Differences
f [ xk ] f ( x k ) Zeroth order DD
f [ x1 ] f [ x0 ]
f [ x0 , x1 ] First order DD
x1 x0
f [ x1 , x2 ] f [ x0 , x1 ]
f [ x0 , x1 , x2 ] Second order DD
x2 x0
............
f [ x1 , x2 ,..., xk ] f [ x0 , x1 ,..., xk 1 ]
f [ x0 , x1 ,..., xk ]
xk x0
64
Divided Difference Table
x F[ ] F[ , ] F[ , , ] F[ , , ,]
x0 F[x0] F[x0,x1] F[x0,x1,x2] F[x0,x1,x2,x3]
x1 F[x1] F[x1,x2] F[x1,x2,x3]
x2 F[x2] F[x2,x3]
x3 F[x3]
n i 1
f n ( x) F [ x0 , x1 ,..., xi ] x x j
i 0 j 0
65
Divided Difference Table
x F[ ] F[ , ] F[ , , ]
xi f(xi)
0 -5 2 -4
1 -3 6
0 -5
-1 -15 1 -3
-1 -15
Entries of the divided difference
table are obtained from the data
table using simple operations.
66
Divided Difference Table
x F[ ] F[ , ] F[ , , ] xi f(xi)
0 -5 2 -4 0 -5
1 -3 6 1 -3
-1 -15 -1 -15
68
Divided Difference Table
x F[ ] F[ , ] F[ , , ] xi yi
0 -5 2 -4 0 -5
1 -3 6
-1 -15 1 -3
-1 -15
15 (3)
6
1 1
f [ x2 ] f [ x1 ]
f [ x1 , x2 ]
x2 x1
69
Divided Difference Table
x F[ ] F[ , ] F[ , , ] xi yi
0 -5 2 -4 0 -5
1 -3 6
-1 -15 1 -3
-1 -15
6 ( 2)
4
1 ( 0)
f [ x1 , x2 ] f [ x0 , x1 ]
f [ x0 , x1 , x2 ]
x2 x0
70
Divided Difference Table
x F[ ] F[ , ] F[ , , ] xi yi
0 -5 2 -4 0 -5
1 -3 6
-1 -15 1 -3
-1 -15
f 2 ( x) 5 2( x 0) 4( x 0)( x 1)
x y x y
1 0 2 3
2 3 1 0
3 8 3 8
72
Two Examples
x Y
x Y
1 0 3 1 2 3 3 1
2 3 5 1 0 4
3 8 3 8
P2 ( x) 0 3( x 1) 1( x 1)( x 2) P2 ( x) 3 3( x 2) 1( x 2)( x 1)
2
x 1 x2 1
73
Properties of Divided Difference
Ordering the points should not affect the divided difference:
f [ x0 , x1 , x2 ] f [ x1 , x2 , x0 ] f [ x2 , x1 , x0 ]
74
Example
Find a polynomial to x f(x)
interpolate the data.
2 3
4 5
5 1
6 6
7 9
75
Example
x f(x) f[ , ] f[ , , ] f[ , , , ] f[ , , , , ]
2 3 1 -1.6667 1.5417 -0.6750
4 5 -4 4.5 -1.8333
5 1 5 -1
6 6 3
7 9
f 4 3 1( x 2) 1.6667( x 2)( x 4) 1.5417( x 2)( x 4)( x 5)
0.6750( x 2)( x 4)( x 5)( x 6)
76
Summary
The interpolating polynomial is unique.
Different methods can be used to obtain it.
Newton’s divided difference
Lagrange interpolation
Others
Polynomial interpolation can be sensitive to
data.
BE CAREFUL when high order polynomials
are used.
77