Lecture Notes 7
Lecture Notes 7
Interpolation and
Approximation
f ( x) a0 a1 x a2 x 2 ... an x n
• For n+1 data points, there is one and only one polynomial of nth order
that passes through all the points. For example, there is only one
straight line (that is, a first-order polynomial that connects two points.
Similarly, only one parabola connects a set of three points.
f(x1)
f(x)
f1(x)
f(x0)
x
x0 x x1
f ( x1 ) f ( x0 )
f1 ( x) f ( x0 ) ( x x0 )
x1 x0
• In general, the smaller the interval between the data points, the better
the approximation.
1.5
• (True value of ln(2)=0.693147)
1
0.5
• Solution: 0
i) x0 1 x1 6
1 2 3 4 5 6
• 1.79176 0
f1 ( x) 0 ( x 1)
f ( x0 ) 0 f ( x1 ) 1.79176 6 1
• ii) x0 1 x1 4
f1 ( x) 0
1.3863 0
( x 1)
f ( x0 ) 0 f ( x1 ) 1.3863 4 1
f 2 ( x) b0 b1 x b1 x0 b2 x 2 b2 x0 x1 b2 x0 x b2 x1 x
• or collecting the terms
f 2 ( x) a0 a1 x a2 x 2
f 2 ( x0 ) b0 b1 ( x0 x0 ) b1 ( x0 x0 )( x0 x1 )
=0 =0
f 2 ( x0 ) b0
and f ( x0 ) f 2 ( x0 ) Therefore b0 f ( x0 ) (2)
• Finally, Eqs. (2) and (3) can be substituted into Eq.(1), which can be
evaluated at x=x2 and solved ( after some algebraic manipulations) for
f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )
x2 x1 x1 x0
b2
x2 x0
f 2 ( x ) 0.565844
CENG 202: NUMERICAL ANALYSIS, DR. SEMIH ERHAN
Interpolation
• 3. General Form of Newton’s Interpolating Polynomials
• The preceding analysis can be generalized to fit an nth order
polynomial to n+1 data points. The nth order polynomial is:
f n ( x) b0 b1 ( x x0 ) ... bn ( x x0 )( x x1 )...( x xn1 )
• b0 , b1, b2, … , bn are first, second, third,…, nth finite divided difference,
respectively. We denote the first divided difference by:
f x0 f ( x0 )
• The second divided difference by;
f ( x1 ) f ( x0 )
f x1 , x0
x1 x0
True value=ln(2)=0.69315
0.69315 0.6288
t 0.0929 9.3%
0.69315
L0 ( x) f ( x0 ) L1 ( x) f ( x1 ) ... Ln ( x) f ( xn )
• where n x xj
Li ( x)
j 0 xi x j
j i
• where π designates the “product of”. For example, the linear version
(n=1) is:
x x1 x x0
f1 ( x) f ( x0 ) f ( x1 )
x0 x1 x1 x0
x x1 x x0
f1 ( x) f ( x0 ) f ( x1 )
x0 x1 x1 x0
24 2 1
f1 (2) 0 1.3863 0.4621
1 4 4 1
• The second order polynomial
f 2 ( x) L0 ( x) f ( x0 ) L1 ( x) f ( x1 ) L2 ( x) f ( x2 )
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
f 2 ( x) f ( x0 ) f ( x1 ) f ( x2 )
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )