Chapter-4: Interpolation
Introduction:
Interpolation is the process of finding a function for any intermediate value of
between a set of discrete data points from to so that the function passes through
all the given data points.
Polynomials are commonly used for interpolation because they are easier to
evaluate, differentiate and integrate – called polynomial interpolation.
• Polynomial Forms:
1. Power form:
The power form of polynomial is
…..i
This form is very convenient to differentiating and integrating the polynomial
function and are widely used in mathematical analysis.
Sometimes inadequate.
khem Sir, WRC 1
2. Shifted power form:
The shifted power form of polynomial is
…..ii
It produce more accurate form than simple power form and here is a point
somewhere in the interval of interest.
Equation (ii) is the Taylor expansion of around the point .
3. Newton form:
This form of polynomial is expressed as
…..iii
• When , it reduces to shifted power form.
• When , it reduces to simple power form.
khem Sir, WRC 2
Methods of Interpolation:
1. Interpolation with unequal intervals
a. Lagrange’s interpolation
b. Newton’s divided difference interpolation
2. Interpolation with equidistance intervals
a. Newton’s forward difference interpolation
b. Newton’s backward difference interpolation
c. Central difference interpolation, Stirling’s formula
3. Spline interpolation (Cubic spline)
Interpolation with unequal intervals:
a. Lagrange’s interpolation:
For points, we have degree of polynomial as
…..i
Or
khem Sir, WRC 3
We know, …..ii
Or,
Equation (i) is called Lagrange interpolation polynomial. The polynomials are known
as Lagrange fundamental polynomials.
• Example:
1. Evaluate by using Lagrange’s interpolation formula for the following data.
Solution:
From the given table, we have
,
khem Sir, WRC 4
The Lagrange formula is
where,
Now, for , we know
khem Sir, WRC 5
Therefore,
• Calculator Code:
Or
Note that for initial step.
Assignment:
2. Find out missing values in the following discrete data using Lagrange interpolation.
-2 0 1 2 3 5 7
84 -10 ? ? -4 ? 60
Solution:
Let, and , then we have
khem Sir, WRC 6
b. Newton’s divided difference interpolation:
The Lagrange’s formula has the drawback that if another interpolation value were
inserted, then the interpolation coefficients are required to be recalculated. This is
overcome in Newton’s divided difference interpolation.
• Newton’s Divided Difference Interpolation Formula:
The Newton’s form of polynomial is
…..i
where interpolation points , , , ……, , acts as centers.
The polynomial fits the data
At , equation (i) reduces to , therefore, .
At ,
Or,
Therefore, ( first divided difference)
khem Sir, WRC 7
At , , then equation (i) can be written as
Or,
Or,
Or,
Therefore, ( second divided difference)
khem Sir, WRC 8
In general, …..ii
Substituting for coefficients in equation (i), we get
…..iii
Equation (iii) is the Newton’s divided difference interpolation formula.
• Divided Difference Table:
To make divided difference table, let us define
(first divided difference)
(second divided difference)
and so on. Then we can construct the divided difference as:
…..iv
khem Sir, WRC 9
The divided difference table is shown below:
i
(First DD) (Second DD) (Third DD) (Fourth DD)
0
Computation is terminated when two consecutive estimates are approximately
equal or their difference is within a specified limit.
khem Sir, WRC 10
• Example:
1. Find from the following data using Newton’s divided difference interpolation
formula. 1 2 3 4 5 6
8.9 9.2 16.3 35.6 72.5 132.4
Solution:
To solve, let us first construct divided difference table as:
0.3000
3.4000
7.1000 0.9000
6.1000 0
19.3000 0.9000 0
8.8000 0
36.9000 0.9000
11.5
59.9000
khem Sir, WRC 11
Now, Newton’s divided difference interpolation formula is
since, lies between 2 and 3, then we have
Therefore,
• On calculator:
i. ii.
and solve for
( Also determine )
khem Sir, WRC 12
Interpolation with equidistance intervals:
a. Newton’s Forward Difference Interpolation:
Newton’s difference interpolation method (forward and backward) is used for
equidistant points. This method is also called Newton’s-Gregory difference
interpolation method.
We use such tables to estimate the value at a non-tabular point.
Most of the engineering and scientific tables are available in this form.
• Newton’s Forward Difference Interpolation Formula:
Let the function take the values corresponding to the equidistant points of .
Suppose we wish to find at point . We know that is the reference point and is the
step size. Also, .
We know that , by definition of , where is the shifting operator, then
then
khem Sir, WRC 13
Since, , then
But we know that, , where, is the forward difference operator. Then
…..i
and we can also write,
From Binomial expansion theorem, we have
,then
Therefore,
…..ii
Equation (ii) is the Newton’s Forward Difference Interpolation Formula.
khem Sir, WRC 14
• Newton’s Forward Difference Table:
khem Sir, WRC 15
• Examples:
1. Derive the formula for computing first and second derivative using Newton’s
forward difference formula.
Solution:
Newton’s forward difference formula is
…..i
We know, , then
…..ii
Differentiating equation (ii) with respect to , we have
khem Sir, WRC 16
Or,
But , therefore
…..iii
Equation (iii) is the first derivative of Newton’s forward difference formula.
Again differentiating equation (iii) with respect to , we obtain second derivative of
Newton’s forward difference formula as:
Therefore, …..iv
khem Sir, WRC 17
b. Newton’s Backward Difference Interpolation Formula:
Let the function take the values corresponding to the equidistant points of .
Suppose we wish to find at point . We know that is the reference point and is the
step size. Also, .
We know that , by definition of , where is the shifting operator, then
then
Since, , then
…..i
From Binomial expansion theorem, we have
, then equation (i) becomes
khem Sir, WRC 18
Now,
Therefore, …..ii
Equation (ii) is the Newton’s backward difference interpolation formula.
In general,
• Choice of the interpolation formula:
The right choice of an interpolation formula depends on the position of the
interpolated value in the given data. The following results will be found useful:
1. To find a tabulated value near the beginning of the table, use Newton’s forward
formula.
2. To find a tabulated value near the end of the table, use Newton’s backward formula.
3. To find a tabulated value near the center of the table, use Stirling’s or Bessel’s
formula.
khem Sir, WRC 19
• Example: Approximate and using appropriate interpolation formula from the
following data:
X 3 4 5 6 7 8 9
Y 4.8 8.4 14.5 23.6 36.2 52.8 73.9
Solution:
Since, lies just before the beginning of the given table, we use Newton’s forward
formula.
Again, lies just after the end of the given table, we use Newton’s backward formula.
o To find , ,
o To find ,
khem Sir, WRC 20
Newton’s forward difference table:
3.6
2.5
6.1 0.5
3 0
9.1 0.5 0
3.5 0 0
12.6 0.5 0
4 0
16.6 0.5
4.5
21.1
khem Sir, WRC 21
We have, Newton’s forward difference formula is
Therefore,
Similarly, we have Newton’s backward formula is
Therefore,
khem Sir, WRC 22
c. Central difference interpolation, Stirling’s formula:
Central difference formulae are best suited for interpolation near the middle of the
table. The central difference table is given below:
khem Sir, WRC 23
1. Stirling’s formula:
Stirling’s central difference formula is given as:
…..i
khem Sir, WRC 24
Spline interpolation (Cubic spline):
The concept of spline interpolation is originated from the mechanical drafting tool
called ‘spline’ used for drawing smooth curves through a given sets of points such
that the slope and curvature are also continuous along the curves, that is, , and are
continuous on the curves. Plotting of the curve was called spline fitting.
• Defining a Spline:
Let the given interval be subdivided into subintervals [, ], [, ], ..., [, ] where < < < ...
< . The points , , ..., are called nodes or knots and , ..., are called internal nodes.
• Spline function: A spline function of degree with nodes , , ..., , is a function
satisfying the following properties.
i. () = (), .
ii. On each subinterval [, ], is a polynomial of degree .
iii. and its first derivatives are continuous on .
khem Sir, WRC 25
The process of constructing such polynomials for a given set of function points is
known as spline interpolation.
• Cubic Spline:
A cubic spline is a piecewise continuous polynomial. A cubic spline has the following
properties:
i. . (Interpolation conditions).
ii. On each subinterval [], is a third degree (cubic) polynomial
khem Sir, WRC 26
iii. and are continuous on .
iv. The second derivatives at the endpoints equal to zero, i.e.,
and ( for natural spline)
Consider the interval []. Using Lagrange interpolation in this interval, can be written
as
…..i
Denote, and , and integrating equation(i) with respect to , we have
…..ii
Again, integrating w. r. t. , we have
…..iii
where and are constants to be determined.
khem Sir, WRC 27
The constants and are determined using the conditions:
and …..iv
Denote, , , and . Also note that the length of the interval []. To ease the
computation, we write,
where, , , then equation (iii) becomes
…..V
Using the condition, , we get
Or,
khem Sir, WRC 28
Again, using the condition , we get
Or,
Substituting the expressions for and in the equation (v), we get the spline in the
interval [] as:
…..vi
Differentiating equation (vi) w. r. t. , we have
…..vii
khem Sir, WRC 29
Put in equation (vi), we get
…..viii
Differentiating equation (viii) w. r. t. , we get
…..ix valid in the
interval []
At , both the derivatives of equations (vii) and (ix) are continuous and equal.
khem Sir, WRC 30
Or,
But and , then
Therefore,
…..x
Equation (x) is used to find and used in unequal interval.
khem Sir, WRC 31
For equispaced interval, we have , then equation (x) becomes
Or,
Therefore,
…..xi
Also put in equation (vi) for equispaced interval.
Note that for natural cubic spline.
• Examples:
1. Estimate the function value at using cubic splines for the given data:
4 9 16
2 3 4
khem Sir, WRC 32
Solution:
From the given data, we know
Here, unequal intervals are given therefore ,
Also ,
Now, we have for cubic spline
Put in above equation, we get
khem Sir, WRC 33
Or,
Therefore,
There are two intervals given ,
and
The cubic spline function is given by
Put in above equation, we get
khem Sir, WRC 34
Since, lies in first interval, i. e. , , we have
Therefore,
1. Using the cubic spline technique, find the cubic polynomial between and from
the following data and also evaluate and .
2 3 4 5 6
5 6 4 3 2
Solution:
The given data are equispaced and also we know, and .
Also, ( for natural cubic spline )
khem Sir, WRC 35
Now, the cubic splines can be obtained as:
,
…..i
But,
khem Sir, WRC 36
Then,
On solving using calculator, we get
Now, the cubic spline in the interval is given by
…..ii
For interval , we take , then
khem Sir, WRC 37
Or,
Therefore,
Now,
Again, , therefore
• Note that, for interval ,
for interval ,
for interval ,
for interval ,
khem Sir, WRC 38
Least Square Method of Fitting Linear and Nonlinear Curve for Discrete Data and
Continuous Function:
Curve fitting is the process of finding a function for any intermediate value of
between and . The function do not necessary to pass through all the given data
points rather it represent the general trend if the data. Curve fitting is also known as
regression analysis.
1. Fitting Straight Line ( or Fitting Linear Equations ):
We know the equation for a straight line is
…..i
where, intercept
slope
Consider at a point , the error is defined as the
vertical distance of this point from the the line .
Then
khem Sir, WRC 39
For fitting a best line, we must consider the following points:
a. Minimizing the sum of errors.
b. Minimizing the sum of absolute value of errors.
c. Minimizing the sum of square of errors.
The technique of minimizing the sum of squares of errors is known as least square
regression. For least square regression method, the value of and can be found as:
…..i
…..ii
Equations (i) and (ii) are called normal equations.
o If , then
khem Sir, WRC 40
• Example: Fit the straight line using least square method. Also find the absolute and
relative error at .
1 2 3 4 5 6 7
0.5 2.5 2 4 3.5 6 5.5
Solution:
From the given table, we know , also we are given . Comparing with , we have , and
.
For straight line , we know
khem Sir, WRC 41
1 0.5 0.5 1
2 2.5 5 4
3 2 6 9
4 4 16 16
5 3.5 17.5 25
6 6 36 36
7 5.5 38.5 49
Now,
On solving using calculator, we get
Therefore, the required straight line is
khem Sir, WRC 42
At
Then, absolute error is,
and, relative error is,
• Calculator code:
To find , , using calculator, we follow following steps:
a. Press MODE and 3
b. Select 3 and put the value of and and press AC
c. Press SHIFT and STAT
d. Select 3 and SUM and choose the required data.
khem Sir, WRC 43
2. Fitting the curve :
We have , …..i
Taking on both sides, we get
…..ii
Comparing with straight line , we get
Now, we have, …..iii
…..iv
Now, we obtain the values of as: . Replacing these values in equation (i), we get the
required equation.
• Example: From the data given below, fit a power function of the form .
1 2 3 4 5
0.5 2 4.5 8 12.5
khem Sir, WRC 44
Solution:
From the given data, we know, and the given curve is
Taking on both sides of the curve, we get
, that is,
Comparing with straight line , we get
Now, we have, …..i
…..ii
0 -0.6931
0.6931 0.6931
1.0986 1.5041
1.3863 2.0794
1.6094 2.5257
khem Sir, WRC 45
Now, equations (i) and (ii) becomes
and
On solving using calculator, we get
then
Therefore, the required equation is
khem Sir, WRC 46
3. Fitting the curve :
We have , …..i
Taking on both sides, we get
…..ii
Comparing with straight line , we get
We have, …..iii
…..iv
Now, we obtain the values of , as: , . Replacing these values in equation (i), we get
the required equation.
• Example: Use regression method to fit geometrical curve to the data given below
and obtain the value of at
0 1 2 3 4 5 6 7
10 21 35 59 92 200 400 610
khem Sir, WRC 47
Solution:
From the given data, we know, and the given curve is
Taking on both sides of the curve, we get
, that is,
Comparing with straight line , we get
Now, we have, and
0 2.3026
1 3.0445
2 3.5553
3 4.0775
4 4.5218
5 5.2983
6 5.9915
7 6.4135
khem Sir, WRC 48
Now, we have,
On solving, we get
Now,
and
Therefore, the required curve is,
khem Sir, WRC 49
4. Fitting the curve :
We have , …..i
Taking on both sides, we get
(
…..ii
Comparing with straight line , we get
We have,
Now, replacing the value of in equation (i), we get the required equation.
Assignment: Fit the following set of data to a curve of form from the following
observation by least square method.
1 2 3 4 5 6
5.5 6.5 9.4 15.2 30.6 49.8
khem Sir, WRC 50
5. Fitting the curve :
We have , …..i
Taking on both sides, we get
(
…..ii
Comparing with straight line , we get
We have, …..iii
…..iv
khem Sir, WRC 51
6. Fitting a parabola (quadratic equation):
Let be the parabola to be fitted to the given set of data points where and to be
calculated. These values can be calculated using following equations:
• Assignment: Using least square method, fit a curve to the following data.
20 40 60 80 100 120
5.5 9.1 14.9 22.8 33.3 46.0
khem Sir, WRC 52