Professional Documents
Culture Documents
MAFE208IU-L7 Interpolation
MAFE208IU-L7 Interpolation
& Interpolation
Lecture 2:
Interpolation
Problem on Flood-tide Levels
The flood-tide levels measured at a station at different
times in a certain day are given in the following table
Time (h) 15 16 17 18
Level (m) 0.4 0.6 1.0 1.2
MAFE208IU-L7 2
The Interpolation Problem
Given a set of n+1 points
(x0 , f ( x0 )), (x1, f ( x1)), ...., (xn , f ( xn ))
Find an nth order polynomial f n (x)
that passes through all points:
MAFE208IU-L7 3
Existence and Uniqueness
Given a set of n+1 points:
(x0 , f ( x0 )), (x1, f ( x1)), ...., (xn , f ( xn ))
Assumption: x0 , x1 ,..., xn are distinct
Theorem:
There is a unique polynomial fn(x) of order ≤ n
such that:
f n ( xi ) = f ( xi ) for i = 0,1,...,n
MAFE208IU-L7 4
Examples of Polynomial Interpolation
Linear Interpolation Quadratic Interpolation
MAFE208IU-L7 5
Linear Interpolation
Given any two points, (x0 , f ( x0 ) ), (x1, f ( x1 ) )
4−2
f1 ( x) = 2 + (x − 1) = 2 x
2 −1
MAFE208IU-L7 6
Quadratic Interpolation
Given any three points:(x0 , f ( x0 )), (x1 , f ( x1 )), and (x2 , f ( x2 ))
The polynomial that interpolates the three points is:
f 2 ( x) = b0 + b1 ( x − x0 ) + b2 (x − x0 )(x − x1 )
where :
b0 = f ( x0 )
f ( x1 ) − f ( x0 )
b1 = f [ x0 , x1 ] =
x1 − x0
f ( x2 ) − f ( x1 ) f ( x1 ) − f ( x0 )
−
x2 − x1 x1 − x0
b2 = f [ x0 , x1 , x2 ] =
x2 − x0
MAFE208IU-L7 7
Divided Differences
f [ xk ] = f ( xk ) 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 kth-order DD
MAFE208IU-L7 8
General nth Order Interpolation
Given any n+1 points: (x0 , f ( x0 )), (x1 , f ( x1 )), ..., (xn , f ( xn ))
The polynomial that interpolates all points is:
i −1
( x − x j )
n
f n ( x) = f [ x0 , x1 ,..., xi ]
i =0 j =0
MAFE208IU-L7 10
Example
Find a polynomial to
interpolate the data. x f(x)
2 3
4 5
5 1
6 6
7 9
MAFE208IU-L7 11
Solution
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 ( x) = 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)
Days 1 3 5 6
Money 2 4 8 3
1/24/2021 14
Lagrange Interpolation
The Interpolation Problem
Given a set of n+1 points:
MAFE208IU-L7 16
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: f n ( x) = f (xi ) i ( x)
i =0
(x − x )
n
i ( x) = (x − x )
j =0, j i
j
i j
MAFE208IU-L7 17
Lagrange Interpolating Polynomial
n
f n ( x) = f (xi ) i ( x)
i =0
(x − x )
n
i ( x) = (x − x )
j =0, j i
j
i j
0 1
Both Newton’s interpolation
method and Lagrange 1 3
interpolation method must
give the same answer. 2 2
3 5
4 4
MAFE208IU-L7 20
Newton’s Interpolation Method
0 1 2 -3/2 7/6 -5/8
1 3 -1 2 -4/3
2 2 3 -2
3 5 -1
4 4
MAFE208IU-L7 21
Interpolating Polynomial
3 7
f 4 ( x ) = 1 + 2( x ) − x ( x − 1) + x ( x − 1)( x − 2)
2 6
5
− x ( x − 1)( x − 2)( x − 3)
8
115 95 2 59 3 5 4
f4 ( x) = 1 + x− x + x − x
12 8 12 8
MAFE208IU-L7 22
Interpolating Polynomial Using
Lagrange Interpolation Method
4
f4 ( x) = f ( xi ) i = 0 + 31 + 2 2 + 5 3 + 4 4
i =0
( x − 1) ( x − 2) ( x − 3) ( x − 4) ( x − 1)( x − 2)( x − 3)( x − 4)
0 = =
(0 − 1) ( 0 − 2) (0 − 3) ( 0 − 4) 24
( x − 0) ( x − 2) ( x − 3) ( x − 4) x ( x − 2)( x − 3)( x − 4)
1 = =
(1 − 0) (1 − 2) (1 − 3) (1 − 4) −6
( x − 0) ( x − 1) ( x − 3) ( x − 4) x ( x − 1)( x − 3)( x − 4)
2 = =
( 2 − 0) ( 2 − 1) ( 2 − 3) ( 2 − 4) 4
( x − 0) ( x − 1) ( x − 2) ( x − 4) x ( x − 1)( x − 2)( x − 4)
3 = =
( 3 − 0) (3 − 1) ( 3 − 2) ( 3 − 4) −6
( x − 0) ( x − 1) ( x − 2) ( x − 3) x ( x − 1)( x − 2)( x − 3)
4 = =
( 4 − 0) ( 4 − 1) ( 4 − 2) ( 4 − 3) 24
MAFE208IU-L7 23
Inverse Interpolation
Error in Polynomial Interpolation
Inverse Interpolation
Problem: Given a table of values
Find x such that: f ( x) = y, where y is given
xi x0 x1 …. xn
yi y0 y1 …. yn
One approach:
Use polynomial interpolation to obtain fn(x) to interpolate the
data then use Newton’s method to find a solution to x
f n ( x) = y
MAFE208IU-L7 25
Inverse Interpolation
Inverse interpolation: xi x0 x1 …. xn
1. Exchange the roles
yi y0 y1 …. yn
of x and y.
2. Perform polynomial
Interpolation on the yi y0 y1 …. yn
new table.
xi x0 x1 …. xn
3. Evaluate
x = f n ( y)
MAFE208IU-L7 26
Inverse Interpolation
x
y
x y
MAFE208IU-L7 27
Inverse Interpolation
Question:
MAFE208IU-L7 28
Inverse Interpolation
Example
x 1 2 3
Problem : y 3.2 2.0 1.6
BE CAREFUL
MAFE208IU-L7 30
10th Order Polynomial Interpolation
2
0.5
true function
-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
MAFE208IU-L7 31
Errors in polynomial Interpolation
Theorem
MAFE208IU-L7 32
Exercise
The flood-tide levels measured at a station at different
times in a certain day are given in the following table
Time (h) 15 16 17 18
Level (m) 0.4 0.6 1.0 1.2
Time (h) 8 9 10 11
Rate (millions S/h) 18 16 12 5
MAFE208IU-L7 35