Beruflich Dokumente
Kultur Dokumente
INTERPOLATION (1)
Open 1
Learning Objectives
Open 2
Introduction
Open 3
Interpolation: to estimate the value of f(x) at a point x
using the given data points
2. Lagrange Polynomials
Open 4
General form of Newton’s interpolating formula
f n ( x ) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
b3 ( x x0 )( x x1 )( x x2 ) ...
bn ( x x0 )( x x1 )...( x xn 1 )
Open 5
General form of Newton’s interpolating formula
b0 f ( x0 )
b1 f [ x1 , x0 ]
Finite divided differences
b2 f [ x2 , x1 , x0 ]....
bn f [ xn , xn 1, ...., x0 ]
f ( xi ) f ( x j )
f [ xi , x j ] First Finite divided difference
xi x j
xn x0
First order/Linear interpolation – for any given two points
f n ( x ) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
b3 ( x x0 )( x x1 )( x x2 ) ...
bn ( x x0 )( x x1 )...( x xn 1 )
When n = 1
f1 ( x) b0 b1 ( x x0 )
f ( x1 ) f ( x0 )
b0 f ( x0 ) b1 f [ x1 , x0 ]
x1 x0
b0 f ( x0 )
When n = 2
b1 f [ x1 , x0 ]
f [ x2 , x1 ] f x1, x0
b2 f [ x2 , x1 , x0 ]
x2 x0
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
Open 8
Estimation of Error for Newton’s polynomial
error for the nth order polynomial is given by
f ( x1 ) f ( x0 )
f1 ( x) f ( x0 ) ( x x0 )
x1 x0
0.1280 0.1058
f1 (710) 0.1058 (710 700)
720 700
0.1169
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
f ( x2 ) f ( x1 )
0.1280 0.1058 f [ x2 , x1 ]
f [ x1 , x0 ] x2 x1
720 700 0.1462 0.1280
0.0222 740 720
0.00111
20 9.1 x 10-4
f [ x2 , x1 ] f [ x1 , x0 ]
divided difference of second f [ x2 , x1 , x0 ]
order x2 x0
0.00091 0.00111
f [ x2 , x1 , x0 ] -0.000005
740 700
Open
12
Quadratic interpolation ( second order interpolation)
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
where
b0 0.1058
b1 f [ x1 , x0 ] 0.00111
b2 f [ x2 , x1 , x0 ] 0.000005
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
Open 13
In interpolation, the objective is to
determine the value f(x) for a given x, if a set of points
((x0, f(x0 ),(x1, f(x1 ), (x2, f(x2 ),... ,(xn, f(xn )) is given.
x 1 2 3 4
Open
since | 3 - x| is the smallest distance, |2 - x|
is the second smallest and so on, then we
must choose x0 = 3, x1 =2, x2 = 4 and x3 = 1
f1 ( x) b0 b1 ( x x0 )
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
f 3 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
b3 ( x x0 )( x x1 )( x x2 )
Open 17
First order interpolation
b0 f ( x0 )
f1 ( x) b0 b1 ( x x0 )
b1 f [ x1 , x0 ]
f1 ( 2.8) ? b2 f [ x2 , x1 , x0 ]
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
f 2 (2.8) ?
x0 = 3, f(x0) = 0.563
x1 = 2, f(x1) = 0.352
x2 = 4, f(x2) = 0.684
Third order interpolation x3 = 1, f(x3) = 0.234
f 3 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
b3 ( x x0 )( x x1 )( x x2 )
f 3 ( 2.8) ?
Open 19
Example 3
The stress data for nine specimens against load are given below:
load 1.9 3.1 4.2 5.1 5.8 6.9 8.1 9.3 100
(kg)
Stress 0.3 0.6 0.4 0.9 0.7 1.1 1.5 1.3 1.6
(ksf)
f 2 (4.5) 0.66131
Open
f 3 (4.5) 0.583788 20
Lagrange Interpolating Polynomials
n x xj
Li ( x)
j 0 xi x j
j i
Open 22
n n x xj
f n ( x) Li ( x) f ( xi ) Li ( x)
i 0 j 0 xi x j
j i
f1 ( x) L0 ( x) f ( x0 ) L1 f ( x1 )
( x x1 ) ( x x0 )
f1 ( x) f ( x0 ) f ( x1 )
Open
( x0 x1 ) ( x1 x0 ) 23
Example
where ( x x1 )( x x2 )
L0 ( x)
( x0 x1 )( x0 x2 )
Open 24
( x x0 )( x x2 ) ( x x0 )( x x1 )
L1 ( x) L2 ( x)
( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )
( x x1 )( x x2 ) ( x x0 )( x x2 )
f 2 ( x) f ( x0 ) f ( x1 )
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 )
( x x0 )( x x1 )
f ( x2 )
( x2 x0 )( x2 x1 )
Open 25
Example
Estimate f2(5), given the following table
x 1 3 6
f(x) 5 13 145
Solution
x0 = 1 f(x0) = 5
x1 = 3 f(x1) = 13 f2(5) = ????
x2 = 6 f(x2) = 145
Open 26
Solution - continued
Open 27
Calculate each of the weights
( x 3)( x 6) x 2 9 x 18
L0 ( x)
(1 3)(1 6) 10
( x 1)( x 6) x2 7x 6
L1 ( x)
(3 1)(3 6) 6
( x 1)( x 3) x2 4x 3
L2 ( x)
(6 1)(6 3) 15
Open 28
n
f n ( x) Li ( x) f ( xi )
Substitute in the formula,
we have i 0
x 2 9 x 18 x2 7x 6 x2 4x 3
f 2 ( x) 5 13 145
10 6 15
8 x 2 28 x 25
Hence f 2 (5) 85
Open 29
Given the following data
x -40 -20 10 70 100 120
f(x) 1250 1280 1350 1480 1580 1700
Open 30
Solution:
x 100 x 70
f1 (80) ( )(1480) ( )(1580)
30 30
1513. 33
f 2 (80) 1502.7
f 3 (80) 1505.6
Open 31
Exercise:
The percentage of Light (L) passing through the sea surface
that penetrates to specific depths(D) in clean water is as
follows:
D (m) 0 1 2 10 50 100
L(%) 100 45 39 22 5 0.5
Open 32
Reading assignment:
Open 33