Lecture Numerical Interpolation
Lecture Numerical Interpolation
Lecture # 07
Numerical Interpolation
ME 261 .. Introduction to Interpolation
f ( x1 ) = a1 + a2 x1 + a3 x12 + an x1n −1
n −1
f ( x2 ) = a1 + a2 x2 + a x 2
3 2 +a x n 2
n −1
f ( xn ) = a1 + a2 xn + a x 2
3 n +a x n n
f ( x2 ) − f ( x1 )
f1 ( x) = f ( x1 ) + ( x − x1 )
x2 − x1
ME 261 .. Quadratic Interpolation
bn = f [ xn , xn −1 , , x 2 , x1 ]
f ( xi ) − f ( x j )
f [ xi , x j ] =
xi − x j
f [ xi , x j ] − f [ x j , xk ] Bracketed function evaluations are
f [ xi , x j , xk ] = finite divided differences
xi − xk
f [ xn , xn −1 , , x2 ] − f [ xn −1 , xn − 2 , , x1 ]
f [ xn , xn −1 , , x2 , x1 ] =
xn − x1
ME 261 .. General Form of Newton’s Interpolating
Polynomials
f ( xi ) − f ( x j ) f [ xi , x j ] − f [ x j , xk ]
f [ xi , x j ] = f [ xi , x j , xk ] =
xi − x j xi − xk
Question: The general form of Newton’s interpolating polynomial is-
f n ( x) = b0 + b1 ( x − x0 ) + b2 ( x − x0 )( x − x1 ) + + bn ( x − x0 )( x − x1 ) ( x − xn −1 )
Show that the coefficients b0, b1, b2,…, bn actually indicate derivates by
Newton’s Divided Difference Method.
ME 261 .. Linear Interpolation
To pass through points (x1, f(x1)) and (x2, f(x2)) we must have:
f1 ( x1 ) = f ( x1 ) Ax1 + B = f ( x1 )
f1 ( x2 ) = f ( x2 ) Ax2 + B = f ( x2 )
2 unknowns and 2 equations Solve for A and B
B = f ( x1 ) − Ax1
Ax2 + f ( x1 ) − Ax2 = f ( x2 )
B
f ( x2 ) − f ( x1 )
A=
x2 − x1
f ( x1 ) x2 − f ( x2 ) x1
B=
x2 − x1
ME 261 .. Linear Interpolation
f ( x2 ) − f ( x1 )
f1 ( x) = f ( x1 ) + ( x − x1 )
x2 − x1
This is Newton’s Divided-Difference first-order interpolating
polynomial.
Where, L’s are the weighing coefficients defined such that it returns
1 at one point and 0 at the other point
x − x2
L1 = 1 at x1 and 0 at x2
x1 − x2
x − x1
L2 = 0 at x1 and 1 at x2
x2 − x1
Substituting these into the interpolating
polynomial x − x2 x − x1
f ( x) = f ( x1 ) + f ( x2 )
x1 − x2 x2 − x1
Linear Lagrange interpolating polynomial
ME 261 .. Lagrange Interpolating Polynomial
Where n x − xj
Li ( x) =
j =1 xi − x j
j i
where n is the number of data points and designates “the product of”
Example 01:
Estimate the natural logarithm of 2 using linear interpolation.
First perform the computation by interpolating between ln 1 =
0 and ln 6 = 1.791759. Then, repeat the procedure, but use a
smaller interval from ln 1 to ln 4 (1.386294). Note that the true
value of ln 2 is 0.6931472.
Solution: For linear interpolation,
f ( x2 ) − f ( x1 )
f1 ( x) = f ( x1 ) + ( x − x1 )
x2 − x1
ME 261 .. Numerical Interpolation
Solution: From x1 = 1 to x2 = 6,
f (6) − f (1) 1.791759 − 0
f1 (2) = f (1) + (2 − 1) = 0 + ( 2 − 1) = 0.3583519
6 −1 6 −1
fexact ( 2 ) − f num ( 2 ) 0.6931472 − 0.3583519
Error, t = 100% = 100% = 48.3%
fexact ( 2 ) 0.6931472
From x1 = 1 to x2 = 4,
f (4) − f (1) 1.386294 − 0
f1 (2) = f (1) + (2 − 1) = 0 + ( 2 − 1) = 0.4620981
4 −1 4 −1
Error, εt = 33.3%
ME 261 .. Numerical Interpolation
Example 02:
Employ a second-order Newton polynomial to estimate ln 2
with the following three points. Note that the true value of ln 2
is 0.6931472.
x 1 4 6
f(x) 0 1.386294 1.791759
ME 261 .. Numerical Interpolation
Error, εt = 18.4%
ME 261 .. Numerical Interpolation
Example 03:
Employ a third-order Newton’s interpolating polynomial to
estimate ln 2 with the following four points. Note that the true
value of ln 2 is 0.6931472.
x 1 4 5 6
f(x) 0 1.386294 1.609438 1.791759
ME 261 .. Numerical Interpolation
Error, εt = 9.3%
ME 261 .. Numerical Interpolation