0% found this document useful (0 votes)
5 views24 pages

Lecture 21

The document discusses interpolation methods used to estimate intermediate values between data points, focusing on linear and quadratic interpolation techniques. It provides examples of estimating the natural logarithm of 2 using both methods and outlines the process for fitting polynomials to data points. Additionally, it covers Newton's Divided Difference Interpolating Polynomials and error estimation for interpolation accuracy.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views24 pages

Lecture 21

The document discusses interpolation methods used to estimate intermediate values between data points, focusing on linear and quadratic interpolation techniques. It provides examples of estimating the natural logarithm of 2 using both methods and outlines the process for fitting polynomials to data points. Additionally, it covers Newton's Divided Difference Interpolating Polynomials and error estimation for interpolation accuracy.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

CHAPTER -18

Interpolation

Numerical Methods of Chemical Engineers


CHE F242
Interpolation
Interpolation is used to estimate the intermediate values between precise data
points.
Polynomial Interpolation
Newton’s Divided-Difference Interpolating
Polynomials
Linear Interpolation
Connects data points with a straight line

• Slope of the line connecting two points


as well as a finite divided difference
approximation of the first derivative.
• The smaller the interval between the
data points, the better the
approximation.
• As the interval decreases, a
continuous function will be better
approximated by a straight line.
Problem
Estimate the natural logarithm of 2 using linear interpolation. (i) First
perform the computation by interpolating between ln1=0 and
ln6=1.791759. (ii) Then repeat the procedure, but use a smaller interval
from ln1 to ln4 (1.386294). Note that the true value of ln2 is 0.6931472.
(i) True relative error = 48.3%

(ii) True relative error = 33.33%

As the interval decreases, a continuous function will be better approximated by


a straight line.
Quadratic Interpolation
• A strategy for improving the linear approximation is to introduce some curvature
into the line connecting the points.
• For three data points, this can be accomplished with a second order polynomial/
Quadratic polynomial/ a parabola
f 2 (x)=b 0 +b1 (x-x 0 )+b 2 (x-x 0 )(x-x1 )
=b 0 +b1x-b1x 0 +b 2 x 2 -b 2 xx 0 -b 2 xx1 +b 2 x 0 x 1
=(b 0 -b1x 0 +b 2 x 0 x1 )+(b1 -b 2 x 0 -b 2 x1 )x+b 2 x 2
=a 0 +a1x+a 2 x 2
where, a 0 (b 0 -b1x 0 +b 2 x 0 x1 )
a 1 (b1 -b 2 x 0 -b 2 x1 )
and a 2 b 2
The values of the coefficient bi, can be determined as:

b 0 =f(x 0 ) f(x 2 )-f(x1 ) f(x1 )-f(x 0 )


-
f(x1 )-f(x 0 ) (x 2  x1 ) (x1  x 0 )
b1  b2 
x1  x 0 (x 2  x 0 )
Problem
Fit a 2nd order polynomial to the three points used in example 1. The three
points are x0=1, x1=4, x2=6, f(x0)=ln1=0, f(x1)= ln4=1.386294 and f(x2)=
ln6=1.791759. Note that the true value of ln2 is 0.6931472.
Solution: b0 =f(x 0 )=0
1.386294  0
b1  0.4620981
4 1
1.791759  1.386294 1.386294  0
-
b2  6 4 4 1  0.0518731
(x 2  x 0 )
Putting x=2,
f 2 (x) b0 +b1 (x-x 0 )+b 2 (x-x 0 )(x-x1 )
=0+0.4620981(2-1)  0.0518731(2-1)(2-4)
=0.5658442 The curvature introduced by the quadratic
formula improves the interpolation compared wit
Et% = 18.366% the result obtained using straight line.
Problem
Fit a 2nd order polynomial to the three points used in example 1. The three
points are x0=1, x1=4, x2=6, f(x0)=ln1=0, f(x1)= ln4=1.386294 and f(x2)=
ln6=1.791759. Note that the true value of ln2 is 0.6931472.

The curvature introduced by the quadratic formula improves the interpolation


compared wit the result obtained using straight line.
Problem
Fit a 2nd order polynomial to the three points used ln5. The three points
are x0=1, x1=6, x2=7, f(x0)=ln1=0, f(x1)= ln6=1.791759 and f(x2)=
ln7=1.94591. Note that the true value of ln5 is 1.6094.
Problem
Fit a 2nd order polynomial to the three points used ln5. The three points
are x0=1, x1=6, x2=7, f(x0)=ln1=0, f(x1)= ln6=1.791759 and f(x2)=
ln7=1.94591. Note that the true value of ln5 is 1.6094.
General form of Newton’s
Interpolating Polynomials
The nth order polynomial is:

Data points can be used to determine the coefficients b 0,b1…bn.


First finite divided difference

Finite
divided
Second finite divided difference
difference

nth finite divided difference


Graphical depiction of the recursive
nature of finite divided difference

Newton’s Divided Difference Interpolating Polynomial

The data points used in this equation does not need to be equally spaced or the
abscissa value does not need to be in ascending order.
Problem
Fit a nth order polynomial to the four points used in example 1. The four
points are x0=1, x1=4, x2=5, x3=6, f(x0)=ln1=0, f(x1)= ln4=1.386294,
f(x2)=ln5=1.60938 and f(x3)= ln6=1.791759. Note that the true value of ln2
is 0.6931472.
Solution:
Problem
Fit a nth order polynomial to the four points used in example 1. The four
points are x0=1, x1=4, x2=5, x3=6, f(x0)=ln1=0, f(x1)= ln4=1.386294,
f(x2)=ln5=1.60938 and f(x3)= ln6=1.791759. Note that the true value of ln2
is 0.6931472.
Solution:
Problem
Fit a nth order polynomial to the four points used in example 1. The four
points are x0=1, x1=4, x2=5, x3=6, f(x0)=ln1=0, f(x1)= ln4=1.386294,
f(x2)=ln5=1.60938 and f(x3)= ln6=1.791759. Note that the true value of ln2
is 0.6931472.
Solution:
Problem
Fit a nth order polynomial to the three points used in example 1. The four
points are x0=1, x1=4, x2=6, x3=5, f(x0)=ln1=0, f(x1)= ln4=1.386294 and
f(x2)= ln6=1.791759, f(x3)=ln5=1.60938. Note that the true value of ln2 is
0.6931472.
Solution:

1st Divided Difference

2nd Divided
Difference
Problem
Fit a nth order polynomial to the three points used in example 1. The four
points are x0=1, x1=4, x2=6, x3=5, f(x0)=ln1=0, f(x1)= ln4=1.386294 and
f(x2)= ln6=1.791759, f(x3)=ln5=1.60938. Note that the true value of ln2 is
0.6931472.
Solution:
3rd Divided Difference

f 3 (x) f(x 0 )+(x-x 0 )f[x 1, x 0 ]+(x-x 0 )(x-x 1)f[x 2 , x 1, x 0 ]


 (x-x 0 )(x-x 1 )(x-x 2 )f[x 3 ,x 2 , x 1, x 0 ]

f 3 (2) 0+(2-1)0.462098+(2-1)(2-4)(-0.051873)
 (2-1)(2-4)(2-6)(0.0078654)
= 0.628768579

Et% = 9.3%
Errors of Newton’s Interpolating
Polynomials
As with the case of Taylor series, a formulation for truncation error
can be obtained:

where ξ is somewhere in the interval containing the unknown and


the data.
It uses a finite divided difference to approximate the (n+1) th
derivative,

where, xn+1 is additional data point


Problem
Estimate the error for the nth order polynomial interpolation of example
2. Use the additional data point f(x3)=f(5)=ln5=1.609438.
Solution:
R2 = |f[x3, x2, x1, x0](x-x0)(x-x1)(x-x2)|
= |(-0.0078654)(x-1)(x-4)(x-6)|
= |(-0.0078654)(2-1)(2-4)(2-6)| where, x=2
= |-0.0629232| = 6.29%

Practice Problem
Error Estimates to determine the appropriate order of
interpolation of the function f(x)=ln2 at x=2. The eight points are
x0=1, x1=4, x2=6, x3=5, x4=3, x5=1.5, x6=2.5, x7=3.5. Note that the true
value of ln2 is 0.6931472.
Practice Problem
Error Estimates to determine the appropriate order of
interpolation of the function f(x)=ln2 at x=2. The eight points are
x0=1, x1=4, x2=6, x3=5, x4=3, x5=1.5, x6=2.5, x7=3.5. Note that the true
value of ln2 is 0.6931472.
f(x i )-f(x j )
• First finite divided difference: f(x i , x j )=
x i -x j

x f(x) (xi-xj) f(xi)-f(xj) f[xi, xj]


x0 = 1 f(x0) = 0 (x1-x0) = 3 f(x1)-f(x0) = 1.386294361 f[x1, x0]=0.4620981
x1 = 4 f(x1) = 1.386294 (x2-x1) = 2 f(x2)-f(x1) = 0.405465108 f[x2, x1]=0.2027326
x2 = 6 f(x2) = 1.791759 (x3-x2) = -1 f(x3)-f(x2) = -0.182321557 f[x3, x2]=0.1823216
x3 = 5 f(x3) = 1.609437912 (x4-x3) = -2 f(x4)-f(x3) = -0.510825624 f[x4, x3]=0.2554128
x4 = 3 f(x4) = 1.098612289 (x5-x4) = -1.5 f(x5)-f(x4) = -0.693147181 f[x5, x4]=0.46209812
x5 = 1.5 f(x5) = 0.405465108 (x6-x5) = 1 f(x6)-f(x5) = 0.510825624 f[x6, x5]=0.5108256
x6 = 2.5 f(x6) = 0.91629072 (x7-x6) = 1 f(x7)-f(x6) = 0.336472237 f[x7, x6]=0.3364722
x7 = 3.5 f(x7) = 1.252762968
Practice Problem f[x , x ] - f[x , x ]
i j j k
• Second finite divided difference: f[x i , x j , x k ]=
x i -x k
f[xn, xn-1] f[xn, xn-1] - f[xn-1, xn-2] (xn - xn-2) f[xn, xn-1, xn-2]
0.46209812 -0.259365566 5 -0.051873113
0.202732554 -0.020410997 1 -0.020410997
0.182321557 0.073091255 -3 -0.024363752
0.255412812 0.206685308 -3.5 -0.059052945
0.46209812 0.048727503 -0.5 -0.097455007
0.510825624 -0.174353387 2 -0.087176694
0.336472237
• Third finite divided f[x n , x n-1 , x n-2 ] - f[x n-1, x n-2 , x n-3 ]
f[x n , x n-1 , x n-2 , x n-3 ]=
difference: x n - x n-3
f[xn, xn-1, xn-2] f[xn, xn-1, xn-2] - f[xn-1, xn-2, xn-3] (xn - xn-3) f[xn, xn-1, xn-2, xn-3]
-0.051873113 0.031462116 4 0.007865529
-0.020410997 -0.003952754 -1 0.003952754
-0.024363752 -0.034689194 -4.5 0.00770871
-0.059052945 -0.038402062 -2.5 0.015360825
-0.097455007 0.010278313 0.5 0.020556626
-0.087176694
Practice Problem
• Fourth finite divided f[x , x , x , x ] - f[x n-1 , x n-2 , x n-3 , x n-4 ]
f[x n , x n-1 , x n-2 , x n-3 , x n-4 ]= n n-1 n-2 n-3
difference: x n - x n-4

f[xn, xn-1, xn-2, xn-3] f[xn, xn-1, xn-2, xn-3]-f[xn-1, xn-2, xn-3, xn-4] xn - xn-4 f[xn, xn-1, xn-2, xn-3, xn-4]
0.007865529 -0.003912775 2 -0.001956387
0.003952754 0.003755955 -2.5 -0.001502382
0.00770871 0.007652115 -3.5 -0.002186319
0.015360825 0.005195802 -1.5 -0.003463868
0.020556626

• Fifth finite f[x , x , x , x , x ] - f[x n-1 , x n-2 , x n-3 , x n-4 , x n-5 ]


f[x n , x n-1 , x n-2 , x n-3 , x n-4 , x n-5 ]= n n-1 n-2 n-3 n-4
divided difference: x n - x n-5

f[xn, xn-1, xn-2, xn-3, xn-4] - f[xn-1, xn-2, xn-3,


f[xn, xn-1, xn-2, xn-3, xn-4] xn-4, xn-5] xn - xn-5 f[xn, xn-1, xn-2, xn-3, xn-4, xn-5]
-0.001956387 0.000454005 0.5 0.00090801
-0.001502382 -0.000683936 -1.5 0.000455958
-0.002186319 -0.001277549 -2.5 0.00051102
-0.003463868
Practice Problem
• Sixth finite
divided f[x n , x n-1 , x n-2 , x n-3 , x n-4 , x n-5 ] - f[x n-1 , x n-2 , x n-3 , x n-4 , x n-5 , x n-6 ]
f[x n , x n-1 , x n-2 , x n-3 , x n-4 , x n-5 , x n-6 ]=
difference: x n - x n-6

f[xn, xn-1, xn-2, xn-3, xn-4, xn-5]-


f[xn, xn-1, xn-2, xn-3, xn-4, xn-5] f[xn-1, xn-2, xn-3, xn-4, xn-5, xn-6] (xn - xn-6) f[xn, xn-1, xn-2, xn-3, xn-4, xn-5, xn-6]
0.00090801 -0.000452053 1.5 -0.000301368
0.000455958 5.50621E-05 -0.5 -0.000110124
0.00051102

• Seventh f[x , x , x , x , x , x , x ]
f[x n , x n-1 , x n-2 , x n-3 , x n-4 , x n-5 , x n-6 , x n-7 ]= n n-1 n-2 n-3 n-4 n-5 n-6
finite x n - x n-7
divided f[x n-1 , x n-2 , x n-3 , x n-4 , x n-5 , x n-6 , x n-7 ]
difference: -
x -x n n-7

f[xn, xn-1, xn-2, xn-3, xn-4, xn-5, xn-6]- f[xn, xn-1, xn-2, xn-3, xn-4, xn-5,
f[xn, xn-1, xn-2, xn-3, xn-4, xn-5, xn-6] f[xn-1, xn-2, xn-3, xn-4, xn-5, xn-6, xn-7] (xn - xn-7) xn-6, xn-7]
-0.000301368 0.000191244 2.5 7.64977E-05
-0.000110124
Practice Problem
Newton’s Divided Difference Interpolating Polynomial

f8 (x)=0 + 0.46209812(x-1) - 0.051873113(x-1)(x-4) + 0.007865529(x-1)(x-4)(x-6)


- 0.001956387(x-1)(x-4)(x-6)(x-5) + 0.00090801(x-1)(x-4)(x-6)(x-5)(x-3)
- 0.000301368(x-1)(x-4)(x-6)(x-5)(x-3)(x-1.5)
+ 0.0000764977(x-1)(x-4)(x-6)(x-5)(x-3)(x-1.5)(x-2.5)
Putting x = 2, we get, f8(2) = ln2 = 0.693438714
• Error Calculation using Newton’s Divided Difference Method:

Let us consider xn+1 = 3.5 as the additional data point


R n  |0.0000764977(x-1)(x-4)(x-6)(x-5)(x-3)(x-1.5)(x-2.5)|
 |-0.0004589862|  0.04589862%
Practice Problem
Solution:
f(x)_Polynomial
x f(x)_True_Value _Interpolation True_Error Error_Newton's_divided_Difference Order
1 0 0.46209812 0.333333333 0.103746227 0
4 1.386294361 0.565844347 0.183659167 0.062924232 1
6 1.791759469 0.628768579 0.092878689 0.046953295 2
5 1.609437912 0.675721874 0.025139404 0.021792249 3
3 1.098612289 0.697514122 0.006300165 -0.003616422 4
1.5 0.405465108 0.693897701 0.001082772 -0.000458986 5
2.5 0.916290732 0.693438714 0.000420594 6
3.5 1.252762968
2 0.693147181

You might also like