MT1009-NUMERICAL METHODS
Dr. Nguyễn Anh Khoa
Email: anh-khoa.nguyen@hcmut.edu.vn
ĐẠI HỌC QUỐC GIA THÀNH PHỐ HỒ CHÍ MINH
TRƯỜNG ĐẠI HỌC BÁCH KHOA
CHAPTER 3: INTERPOLATION
AND APPROXIMATION FOR FUNCTION
I.
POLYNOMIAL INTERPOLATION
II.
CUBIC SPLINES
III. LEAST SQUARE METHOD
INTERPOLATION
14
Shelf-life
Example:
Storage 10 oil vials at different temperature x,
x = 20, 30, 35, 40, 50 °C , each measured in
duplicate. We then acquired a dataset including 10
points of shelf-life.
(months)
12
10
8
6
Question:
How can we determine the shelf-life at a storage
temperature between 20 and 50 °C?
20
30 35 40
Storage temperature
(° C)
POLYNOMIAL INTERPOLATION
We need to express x and y by a polynomial interpolation:
Pn ( x ) = an x n + an −1 x n −1 + ... + a1 x + a0
Such that: Pn ( xi ) = yi at xi , i = 1,..., n called nodes
(months)
y = P( x)
14
12
Y (SL)
10
8
6
20
30 35 40
X (temperature)
(° C)
POLYNOMIAL INTERPOLATION
Definition:
Provide n distinct pairs of (xi,yi) of function f(x),
polynomial interpolation of f(x) if it exists (Pn(x)) with ≤ n) is unique.
POLYNOMIAL INTERPOLATION
Definition:
Provide n distinct pairs of (xi,yi) of function f(x),
polynomial interpolation of f(x) if it exists (Pn(x)) with ≤ n) is unique.
Suppose that we have P(x) and Q(x) of f(x) which all satisfy:
P ( xi ) = yi and Q ( xi ) = yi
Let g ( x) = P( x) − Q( x)
Then: P( xi ) − Q( xi ) = 0, i = 1,..., n
Then g(x) has n+1 of 0, then g ( x) 0 or P( x) Q( x)
POLYNOMIAL INTERPOLATION
Example: Provide that f(x) is defined by:
X
Y
0
1
1
-1
3
2
Determine the polynomial interpolation of f(x).
POLYNOMIAL INTERPOLATION
Example: Provide that f(x) is defined by:
X
Y
0
1
1
-1
3
2
Determine the polynomial interpolation of f(x).
LAGRANGE POLYNOMIAL INTERPOLATION
f(x) is defined by:
X
Y
X0
Y0
X1
Y1
X2
Y2
…
…
Xn
Yn
Determine the polynomial interpolation (PI) of f(x) on [X0, Xn], n ≥ 1.
Determine the PI Ln ( x ) with n which satisfies : Ln ( xi ) = yi
LAGRANGE POLYNOMIAL INTERPOLATION
Ln ( xi ) = yi
n
Ln ( x) = Li ( x) yi
i =1
1, i = j
Li ( x j ) =
0, i j
LAGRANGE POLYNOMIAL INTERPOLATION
n
Lagrange polynomial interpolation: Ln ( x) = Li ( x) yi
i =1
The polynomial interpolation Ln ( x ) with n satisfies Ln ( xi ) = yi
1, i = j
Li ( x j ) =
0, i j
Li ( x ) = Ci ( x − x0 ) ( x − x1 )( x − xi −1 )( x − xi +1 )
( x − xn )
Li ( xi ) = Ci ( xi − x0 )( xi − x1 )( xi − xi −1 )( xi − xi +1 )
( xi − xn )
Li ( xi ) = Ci ( xi − x0 )( xi − x1 )( xi − xi −1 )( xi − xi +1 )
( xi − xn ) = 1
x − x0 ) ( x − x1 )( x − xi −1 )( x − xi +1 ) ( x − xn )
(
Li ( x ) =
( xi − x0 )( xi − x1 )( xi − xi−1 )( xi − xi+1 ) ( xi − xn )
LAGRANGE POLYNOMIAL INTERPOLATION
Example: Determine Lagrange polynomial interpolation of y = sin( x)
at nodes 0, 1/6, and 1/2.
LAGRANGE POLYNOMIAL INTERPOLATION
Example: Determine Lagrange polynomial interpolation of y = sin( x)
at nodes 0, 1/6, and 1/2.
LAGRANGE POLYNOMIAL INTERPOLATION
Let
Then
Then, Lagrange polynomial interpolation is
with
LAGRANGE POLYNOMIAL INTERPOLATION
LAGRANGE POLYNOMIAL INTERPOLATION
EXAMPLE
Example
Provide that y is defined by
Using the Lagrange polynomial interpolation is to calculate the y at x = 2
LAGRANGE POLYNOMIAL INTERPOLATION
EXAMPLE
Provide that y is defined by
Using the Lagrange polynomial interpolation is to calculate the y at x = 2
Solve
Then
7
NEWTON POLYNOMIAL INTERPOLATION
Provide that f(x) is defined as
on
Definition
On interval
We define that
called the first order divided difference of function f on
NEWTON POLYNOMIAL INTERPOLATION
In this manner, the 2nd order divided difference of function f(x) on
is
In this manner, the pth order divided difference of function f(x) on
is
NEWTON POLYNOMIAL INTERPOLATION
EXAMPLE
Write a table of divided difference of a function of
NEWTON POLYNOMIAL INTERPOLATION
EXAMPLE
Write a table of divided difference of a function of
NEWTON POLYNOMIAL INTERPOLATION
The first order divided difference of f(x) on [x, x0] is
(1)
The second order divided difference of f(x) on [x, x0] is
(2)
Substituting (2) into (1) provides:
NEWTON POLYNOMIAL INTERPOLATION
In this manner to nth step we get:
Let
and
then we get
FORWARD NEWTON
POLYNOMIAL INTERPOLATION
BACKWARD NEWTON
POLYNOMIAL INTERPOLATION
NEWTON POLYNOMIAL INTERPOLATION
EXAMPLE
Provide the table of function y = f(x):
Calculate the forward Newton polynomial interpolation starting at node x0 of y = f(x)
Using the interpolation at step 1 is to calculate f(x) at x = 1.25
NEWTON POLYNOMIAL INTERPOLATION
SOLVE
Divided diff I
Divided diff II
Divided diff III
Divided diff IV
NEWTON POLYNOMIAL INTERPOLATION
The expression of forward Newton interpolation is