Professional Documents
Culture Documents
Chapter 8 Interpolation
Chapter 8 Interpolation
Chapter 8 Interpolation
INTERPOLATION
Interpolation
Interpolation
p ( xk ) yk , k 0,1..., n
y ( x ) pn ( x )
prepared by Razana Alwee
Example
k 0 1 2 3 4 5
xk 10
. 12
. 14
. 16
. 18
. 2.0
yk 0.0000 01823
. 0.3365 0.4700 0.5878 0.6931
y(1.1) = ??
y(1.5) = ??
Let,
x x0 rh
then the difference x-xi can be written as
x xi (r i )h
r (r 1) 2 r (r 1)...r n 1 n
p n ( x) y k ry k y k ... yk
2! n!
r x xk / h
Peringkat TandaanNotationTakrif
Forward-difference
0 0 y k yk
1 1 y k y k 1 y k
2 2 y k y k 1 y k
... ... ...
j j yk j 1 y k 1 j 1 y k
Forward-difference Table
k xk yk y k 2 y k ... n 1 y k n y k
0 x0 y0 y 0 2 y 0 ... n 1 y 0 n y 0
1 x1 y1 y1 2 y1 ... n 1 y1
... ... ... ... .... ...
n 2 x n 2 y n2 y n 2 2 y n 2
n 1 x n 1 y n 1 y n 1
n xn yn
prepared by Razana Alwee
Example
k 0 1 2 3 4 5
xk 1 .0 1.2 1.4 1.6 1.8 2.0
yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333
Solution
Forward-difference Table
k xk yk y k 2 y k 3 y k 4 y k 5 y k
0 1. 0 0.5000 0.0455 0.0077 0.0020 0.0009 0.0007
1 1. 2 0.4545 0.0378 0.0057 0.0011 0.0002
2 1. 4 0.4167 0.0321 0.0046 0.0009
3 1. 6 0.3846 0.0275 0.0037
4 1.8 0.3571 0.0238
5 2. 0 0.3333
10
Solution
Solution
Polynomial
r( r 1) 2 r( r 1)( r 2 ) 3
p5 ( x ) y 0 ry 0 y0 y0
2! 3!
r( r 1)( r 2 )( r 3) 4 r( r 1)( r 2)( r 3)( r 4 ) 5
y0 y0
4! 5!
( 0.5)( 0.5 1)
p5 (1.1) 0.5000 ( 0.5 )( 0.0455) ( 0.0077)
2
( 0.5)( 0.5 1)( 0.5 2) ( 0.5)( 0.5 1)( 0.5 2)( 0.5 3)
( 0.0020) ( 0.0009)
6 24
( 0.5)( 0.5 1)( 0.5 2)( 0.5 3)( 0.5 4 )
( 0.0007)
120
0.5000 0.02275 0.0009625 0.000125 0.0000352 0.0000191
0.4761
prepared by Razana Alwee
12
12
Conclusion
Exercise
■ Given
X 0.0 1.0 2.0 3.0 4.0
f(x) 0.00 0.75 2.25 3.00 2.25
x = x0 + rh with 0 r n
In general:
x = x1 + (r + n – 1)h
Proven:
x x n ( x n rh ) x n rh
x x n 1 ( x n rh ) ( x n h ) ( r 1)h
x x n 2 ( x n rh ) ( x n 2h ) ( r 2 )h
:
x x 1 ( x n rh ) ( x n ( n 1)h ) ( r n 1)h
x x1 ( r n 1)h
r ( r 1) 2 r ( r 1)...r n 1 n
p n ( x ) y k ry k y k ... yk
2! n!
r = (x – xk) / h
Example
k 0 1 2 3 4 5
xk 1.0 1.2 1.4 1.6 1.8 2.0
yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333
Solution
Solution
Solution
Polynomial
r (r 1) 2 r ( r 1)(r 2) 3
p5 ( x) y5 ry5 y5 y5
2! 3!
r (r 1)(r 2)(r 3) 4 r ( r 1)(r 2)(r 3)(r 4) 5
y5 y5
4! 5!
( 0.5)(0.5 1)
p5 (1.9) 0.3333 (0.5)(0.0238) (0.0037)
2
(0.5)(0.5 1)(0.5 2) (0.5)(0.5 1)(0.5 2)(0.5 3)
(0.0009) (0.0002)
6 24
(0.5)(0.5 1)(0.5 2)(0.5 3)(0.5 4)
( 0.0007)
120
0.3333 0.0119 0.0004625 0.00005625 0.000007869 0.0000191
0.3448 prepared by Razana Alwee
25
25
Conclusion
Example
f ( x ) 3 sin 2 ( x / 6 )
prepared by Razana Alwee
27
27
Solution
Solution
Polynomial
r( r 1 ) 2 r ( r 1)( r 2 )
p 4 ( x ) f ( x 4 ) r f ( x 4 ) f ( x4 )
2! 3!
r ( r 1 )( r 2 )( r 3 )
3f ( x 4 ) 4f ( x 4 )
4!
( 0.5 )( 0.5 1)
p 4 ( 3.5 ) 2 .25 ( 0 .5 )( 0 .75 ) ( 1.50 )
2
( 0 .5 )( 0 .5 1)( 0 .5 2 )
( 0 .75 )
6
( 0 .5 )( 0 .5 1)( 0 .5 2 )( 0.5 3 )
( 0 .75 )
24
2 .25 0 .375 0 .1875 0.046875 0 .02929 2 .83
prepared by Razana Alwee
29
29
Solution
f ( x ) 3 sin 2 ( x / 6 )
f(3.5) 3 sin 2 [ 3.1412 * ( 3.5 ) / 6 ) 2.7990
p 4 ( 3.5 ) 2.83
p( x ) f ( x )
Exercise
Given
(0.0 , 0.0), (0.2 , 1.05), (0.4 , 0.85), (0.6 , 0.35),
(0.8 , 0.10), (1.0 , 1.0).
Use an appropriate interpolation technique to determine the
approximation value of :
y(0.1)
y(0.9)
Newton’s Divided-Difference
f ( xk 1 ) f ( xk ) f fk
f [ xk , xk 1 ] k 1
xk 1 xk xk 1 xk
32
Newton’s Divided-Difference
f [ xk 1 , xk 2 ] f [ xk , xk 1 ]
f [ xk , xk 1 , xk 2 ]
xk 2 xk
33
0 x0 f0 f [ x0 , x1 ]
f [ x1 ] f [ x0 ]
f [ x0 , x1, x2 ]
f [ x1 , x2 ] f [ x0 , x1 ] … f [ x1 , x2 ,...xn ] f [ x0 , x1 ...xn 1 ]
x1 x0 x2 x0 f [ x0 , x1 ,...xn ]
xn x0
1 x1 f [ x2 ] f [ x1 ]
f1 f [ x1, x2 ]
x2 x1 f [ x1 , x2 , x3 ]
f [ x2 , x3 ] f [ x1 , x2 ] …
x3 x1
… … … … …
n xn fn
34
Newton’s Divided-Difference
f [ x 0 ] f [ x 0 , x1 ]( x x 0 )
f [ x 0 , x1 , x 2 ]( x x 0 )( x x1 ) ...
f [ x 0 , x1 ,...., x n ]( x x 0 )( x x1 )...( x x n 1 )
35
Example
36
Solution
37
Solution
Calculation
y1 y 0 0.3846 0.5000
f x0 , x1 0.1923
x1 x0 1 . 6 1 .0
f x1 , x 2 f x 0 , x1 0. 1099 ( 0 .1923 )
f x0 , x1 , x 2 0. 0550
x2 x0 2 . 5 1 .0
f [ x1 , x 2 , x3 ] f [ x 0 , x1 , x 2 ] 0 .0275 0 .0549
f [ x0 , x1 , x 2 , x3 ] 0 .0137
x3 x0 3 . 0 1 .0
f [ x1 , x 2 , x 3 , x 4 ] f [ x0 , x1 , x 2 , x3 ]
f [ x0 , x1 , x 2 , x3 , x 4 ]
x 4 x0
0 .0066 0.0137
0 .0032
3 .2 1 . 0
38
Solution
39
Newton’s Divided-Difference
Conclusion
Can be used to determine the approximation of the point
lies near the beginning of the table where x0 < x < x1.
The data need to be reordered, if the point is not located
at the beginning of the table
Determine the range of data where the point is located and label
the lower bound range as, x0 and the upper bound as x1
Ordered the data starting with the value that closest with the
point as x2 followed by the other values as x3,x4….xn where xn
have the largest gap with the point.
40
Example 2
k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381
41
Solution
Position of X= 2.8
k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381
42
Solution
43
Solution
Solution
Polynomial expression
p 4 ( x ) y 0 f [ x 0 , x1 ]( x x 0 ) f [ x 0 , x 1 , x 2 ]( x x 0 )( x x 1 )
f [ x 0 , x 1 , x 2 , x 3 ]( x x 0 )( x x 1 )( x x 2 )
f [ x 0 , x 1 , x 2 , x 3 , x 4 ]( x x 0 )( x x 1 )( x x 2 )( x x 3 )
44
Exercise
45
Denoted as Lk(x).
Suitable do the approximation value of point for non
uniform data.
Interpolation is relied on the number of data that been
given
n
p n ( x ) L 0 ( x )y 0 L 1( x )y 1 ....... L n ( x )y n L i ( x )y i
i0
46
Where
n (x xj ) ( x x 0 ) ( x x k 1 )( x x k 1 )( x x n )
L k(x)
j 0 (xk xj ) ( x k x 0 ) ( x k x k 1 )( x k x k 1 )( x k x n )
j k
1, jika, k j
Subject to L k(xj )
0 , jika , k j
n
Lk(x) 1
It shows that k 0
47
Example
Given
k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381
48
Solution
49
Solution
Calculate L0(1.3)
(1.3 x1 )(1.3 x 2 )(1.3 x 3 )(1.3 x 4 )
L 0 (1.3 )
( x 0 x 1 )( x 0 x 2 )( x 0 x 3 )( x 0 x 4 )
(1.3 1.6 )( 1.3 2.5 )(1.3 3.0 )(1.3 3.2 )
0.2936
(1.0 1.6 )(1.0 2.5 )(1.0 3.0 )(1.0 3.2 )
Calculate L1(1.3)
(1.3 x 0 )(1.3 x 2 )(1.3 x 3 )(1.3 x 4 )
L 1 (1.3)
( x1 x 0 )( x 1 x 2 )( x 1 x 3 )( x1 x 4 )
(1.3 1.0 )(1.3 2.5 )(1.3 3.0 )(1.3 3.2 )
0.9613
(1.6 1.0 )(1.6 2.5 )(1.6 3.0 )(1.6 3.2 )
50
Solution
Calculate L2(1.3)
(1.3 x 0 )( 1.3 x1 )( 1.3 x 3 )( 1.3 x 4 )
L 2 (1.3)
( x 2 x 0 )( x 2 x1 )( x 2 x 3 )( x 2 x 4 )
( 1.3 1.0 )( 1.3 1.6 )( 1.3 3.0 )( 1.3 3.2 )
0.6152
( 2.5 1.0 )( 2.5 1.6 )( 2.5 3.0 )( 2.5 3.2 )
Calculate L3(1.3)
(1.3 x 0 )(1.3 x 1 )(1.3 x 2 )(1.3 x 4 )
L 3 (1.3 )
( x 3 x 0 )( x 3 x 1 )( x 3 x 2 )( x 3 x 4 )
(1.3 1.0 )(1.3 1.6 )(1.3 2.5 )(1.3 3.2 )
0.7329
( 3.0 1.0 )( 3.0 1.6 )( 3.0 2.5 )( 3.0 3.2 )
51
Solution
Calculate L4(1.3)
(1.3 x 0 )(1.3 x 1 )(1.3 x 2 )(1.3 x 3 )
L 4 (1.3 )
( x 4 x 0 )( x 4 x 1 )( x 4 x 2 )( x 4 x 3 )
(1.3 1.0 )(1.3 1.6 )(1.3 2.5 )(1.3 3.0 )
0.3726
( 3.2 1.0 )( 3.2 1.6 )( 3.2 2.5 )( 3.2 3.0 )
Check:
4
L i (1.3) L 0 (1.3) L 1( 1.3 ) L 2 (1.3) L 3 (1.3 ) L 4 (1.3)
i 0
0.2936 0.9613 0.6152 0.7329 0.3726 1
52
Solution
Thus,
4
p 4 (1.3) L i (1.3 )y i
i 0
0.4353
53
Exercise
Given
k 0 1 2 3 4
xk 2.0 3.0 6.5 8.0 12.0
f(xk) 14.0 20.0 17.0 16.0 23.0
54
62
be minimum
The minimum value of S can be obtained when the
partial differential is equal 0 for j = 0, 1, …, m
S n
a j
2 a 0 a 1x a m x m f k x kj 0
k 0
63
It gives
n n n n
a 0 x kj a 1 x jk 1 a m x jk m x kj f k
k 0 k 0 k 0 k0
64
where
n
s j x kj , j 0 ,1, 2 , , 2 m
k0
n
v l x lk f k , l 0 ,1, 2 , , m
k0
Matrix form
s0 s1 sm a 0 v 0
s s2 s m 1 a 1 v 1
1
s m s m 1 s 2 m a m v m
65
66
Example
k 0 1 2 3 4
xk 1 3 4 5 8
fk 5 9 11 13 19
67
Solution
s 0 s1 a 0 v 0
s s a v
1 2 1 1
where
4
s j x kj , j 0 , 1 , 2
k0
and
4
v l x kl f k , l 0 , 1
k 0
68
Solution
Calculation table:
69
Solution
In matrix form :
5 21 a 0 57
21 115 a 293
1
Solution, a0 = 3.0 dan a1 = 2.0
Therefore, the polynomial expression is p(x) = 2.0x + 3.0
To determine f(4.5):
p( 4.5 ) 2.0( 4.5 ) 3.0 12
f ( 4.5 ) p( 4.5 ) 12
70
Exercise
x 1 2 3 4 5
f(x) 0.50 1.40 2.00 2.50 3.10
71