Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
0 views

Notes-Curve fitting & Interpolation

The document discusses curve fitting and interpolation methods, including the method of least squares, Newton's interpolation, and Lagrange's interpolation. It explains how to fit different types of curves, such as straight lines, parabolas, and exponential functions, using mathematical equations and normal equations. Examples are provided to illustrate the fitting process and calculation of residuals for various datasets.

Uploaded by

dhanyasuki05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Notes-Curve fitting & Interpolation

The document discusses curve fitting and interpolation methods, including the method of least squares, Newton's interpolation, and Lagrange's interpolation. It explains how to fit different types of curves, such as straight lines, parabolas, and exponential functions, using mathematical equations and normal equations. Examples are provided to illustrate the fitting process and calculation of residuals for various datasets.

Uploaded by

dhanyasuki05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

CURVE FITTING AND INTERPOLATION

Curve fitting – Method of least squares - Newton’s forward and backward


difference interpolation – Divided differences – Newton’s divided difference
interpolation - Lagrange’s interpolation – Inverse interpolation.

CURVE FITTING

Curve fitting is a problem that arises very frequently in science and


engineering. Suppose that from some experiment n observations, i.e.
values of a dependent variable y measured at specified values of an
independent variable x, have been collected. In other words, we have a
set of n data points (𝑥1, 𝑦1 ), (𝑥2, 𝑦2 ) … (𝑥𝑛, 𝑦𝑛 ). The first step in constructing a
mathematical model of the underlying physical process is to plot these
data points and postulate a function form f(x) to describe the general
trend in the data.
Curve fitting is the process of introducing mathematical relationships
between dependent and independent variables in the form of an equation
for a given set of data.
Method of least squares

Method of least squares is a mathematical procedure for finding the best-


fitting curve to a given set of points by minimizing the sum of the squares
of the the residuals of the points from the curve. The sum of the squares of
the residuals is used instead of the absolute values because this allows the
residuals to be treated as a continuous differentiable quantity.

The best fit in the least-squares sense minimizes the sum of


squared residuals (a residual being: the difference between an observed
value, and the fitted value provided by a model).

Principle of least squares:

The curve of best fit is that for which the sum of the squares of the errors
is a minimum. Let the given points be (𝑥1, 𝑦1 ), (𝑥2, 𝑦2 ) … (𝑥𝑛, 𝑦𝑛 ), and let the
corresponding values of 𝑦 on the fitted curve be 𝑦1 ′ , 𝑦2 ′ , . . . . . . . 𝑦𝑛 ′ .

Then 𝑦𝑖 − 𝑦𝑖 ′ , 𝑖 = 1,2, . . . . 𝑛 give the errors or residuals at 𝑥𝑖 , 𝑖 = 1,2, . . . . 𝑛.


2
The curve of best fit is that for which ∑𝑛𝑖=1(𝑦𝑖 − 𝑦𝑖 ′ ) is minimum.
In practice, the vertical offsets from a line are almost always minimized
instead of the perpendicular offsets

Fitting a straight line

Consider the data:𝑥: 𝑥1 𝑥2 … … … . 𝑥𝑛


𝑦: 𝑦1 𝑦2 . . . . . . . . . . 𝑦𝑛
A straight line can be fitted to the given data by the method of least
squares. The equation of a straight line or least square line is 𝑦 = 𝑎𝑥 + 𝑏,
where 𝑎 and 𝑏 are constants or unknowns.
To compute the values of these constants we need as many equations as
the number of constants in the equation. These equations are called
normal equations. In a straight line there are two constants 𝑎 and 𝑏, so
we require two normal equations.
The normal equations for fitting a straight line are
∑ 𝑦 = 𝑎 ∑ 𝑥 + 𝑛𝑏and∑ 𝑥𝑦 = 𝑎 ∑ 𝑥 2 + 𝑏 ∑ 𝑥
Fitting a parabola (or a second degree curve)

To fit a second degree curve 𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐to a given data, the normal


equations are:
∑ 𝑦 = 𝑎 ∑ 𝑥 2 + 𝑏 ∑ 𝑥 + 𝑛𝑐

∑ 𝑥𝑦 = 𝑎 ∑ 𝑥 3 + 𝑏 ∑ 𝑥 2 + 𝑐 ∑ 𝑥
2
∑ 𝑥2𝑦 = 𝑎 ∑ 𝑥4 + 𝑏 ∑ 𝑥3 + 𝑐 ∑ 𝑥
Solving these three equations, we get the values of 𝑎, 𝑏, 𝑐. Substituting
these values in the equation 𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐, we get the required second
degree curve.

Fitting an exponential curve

1. To fit a curve of the form 𝒚 = 𝒂𝒃𝒙


Procedure:
Taking 𝑙𝑜𝑔𝑒 on both sides, we get,
𝑙𝑜𝑔𝑒 𝑦 = 𝑙𝑜𝑔𝑒 𝑎 + 𝑥 𝑙𝑜𝑔𝑒 𝑏
Substituting 𝑌 = 𝑙𝑜𝑔𝑒 𝑦 , 𝐴 = 𝑙𝑜𝑔𝑒 𝑎 , 𝐵 = 𝑙𝑜𝑔𝑒 𝑏, we get
𝑌 = 𝐴 + 𝐵𝑥.
Using the procedure for fitting a straight line, we can find the values of
𝐴and𝐵.
Then 𝑎 = 𝑒 𝐴 and𝑏 = 𝑒 𝐵 . Substitute in the equation 𝒚 = 𝒂𝒃𝒙
2. To fit a curve of the form 𝒚 = 𝒂𝒙𝒃
Procedure:
Taking 𝑙𝑜𝑔10 on both sides, we get,
𝑙𝑜𝑔10 𝑦 = 𝑙𝑜𝑔10 𝑎 + 𝑏 𝑙𝑜𝑔10 𝑥
Substituting 𝑌 = 𝑙𝑜𝑔10 𝑦 , 𝐴 = 𝑙𝑜𝑔10 𝑎 , 𝑋 = 𝑙𝑜𝑔10 𝑥, we get
𝑌 = 𝐴 + 𝑏𝑋.
Using the procedure for fitting a straight line, we can find the values of
𝐴and𝑏.
Then 𝑎 = 10𝐴 . Substitute in the equation 𝒚 = 𝒂𝒙𝒃
3. To fit a curve of the form 𝒚 = 𝒂𝒆𝒃𝒙
Procedure:
Take 𝑙𝑜𝑔𝑒 on both sides, we get,
𝑙𝑜𝑔𝑒 𝑦 = 𝑙𝑜𝑔𝑒 𝑎 + 𝑏𝑥
Substituting 𝑌 = 𝑙𝑜𝑔𝑒 𝑦 , 𝐴 = 𝑙𝑜𝑔𝑒 𝑎, we get
𝑌 = 𝐴 + 𝑏𝑥.
Using the procedure for fitting a straight line, we can find the values of
𝐴and𝑏.
Then 𝑎 = 𝑒 𝐴 . Substitute in the equation 𝒚 = 𝒂𝒆𝒃𝒙

Calculation of sum of squares of residuals:


For straight line fit,
𝐸 = ∑ 𝑦 2 − 𝑎 ∑ 𝑥𝑦 − 𝑏 ∑ 𝑦

(i.e., consider 𝑦 − (𝑎𝑥 + 𝑏), multiply by 𝑦and then take 


For parabola fit,
𝐸 = ∑ 𝑦 2 − 𝑎 ∑ 𝑥 2 𝑦 − 𝑏 ∑ 𝑥𝑦 − 𝑐 ∑ 𝑦

(i.e., consider 𝑦 − (𝑎𝑥 2 + 𝑏𝑥 + 𝑐), multiply by 𝑦and then take 


Example 1: Fit a straight line to the data given below. Also estimate the
value of 𝑦 at 𝑥 = 2.5
𝑥: 0 1 2 3 4
𝑦: 1 1.8 3.3 4.5 6.3
Solution:
Let the line of best fit be 𝑦 = 𝑎𝑥 + 𝑏
The normal equations are
∑ 𝑦 = 𝑎 ∑ 𝑥 + 𝑛𝑏and ……..(1)
∑ 𝑥𝑦 = 𝑎 ∑ 𝑥 2 + 𝑏 ∑ 𝑥……...(2)
𝑥 𝑦 𝑥2 𝑥𝑦

0 1 0 0

1 1.8 1 1.8

2 3.3 4 6.6

3 4.5 9 13.5

4 6.3 16 25.2

10 16.9 30 47.1
∑ 𝑥 = 10, ∑ 𝑦 = 16.9, ∑ 𝑥 2 = 30, ∑ 𝑥𝑦 = 47.1
Substituting in equations (1) and (2),
Solving, we get 𝑎 = 1.33, 𝑏 = 0.72
Hence the required equation is 𝑦 = 1.33𝑥 + 0.72
When 𝑥 = 2.5, 𝑦 = 1.33(2.5) + 0.72 = 4.045

2. Fit a curve of the form 𝒚 = 𝒂𝒙𝒃 to the data:


x: 1 2 3 4 5 6
y: 1200 900 600 200 110 50
Solution:
Taking 𝑙𝑜𝑔10 on both sides, we get,𝑙𝑜𝑔10 𝑦 = 𝑙𝑜𝑔10 𝑎 + 𝑏 𝑙𝑜𝑔10 𝑥
Substituting 𝑌 = 𝑙𝑜𝑔10 𝑦 , 𝐴 = 𝑙𝑜𝑔10 𝑎 , 𝑋 = 𝑙𝑜𝑔10 𝑥, we get
𝑌 = 𝐴 + 𝑏𝑋.Using the procedure for fitting a straight line, we can find the
values of 𝐴and𝑏.
Then 𝑎 = 10𝐴 . Substitute in the equation 𝒚 = 𝒂𝒙𝒃
The normal equations are
∑ 𝑌 = 𝑏 ∑ 𝑋 + 6𝐴……..(1)
∑ 𝑋𝑌 = 𝑏 ∑ 𝑋 2 + 𝐴 ∑ 𝑋……...(2)
𝑥 𝑦 X Y 𝑋2 𝑋𝑌
1 1200 0 3.0792 0 0
2 900 0.3010 2.9542 0.0906 0.8892
3 600 0.4771 2.7782 0.2276 1.3255
4 200 0.6021 2.3010 0.3625 1.3854
5 110 0.6990 2.0414 0.4886 1.4269
6 50 0.7781 1.6990 0.6054 1.3220
Total 2.8573 14.8530 1.7747 6.3490

Sub the values in (1) and (2), we have


6𝐴 + 2.8573𝑏 = 14.8530
2.8573𝐴 + 1.7747𝑏 = 6.3490
Solving A=3.3086,b=-1.7494,Then 𝑎 = 10 𝐴 = 2035
Hence the equation is 𝒚 = 𝟐𝟎𝟑𝟓𝒙−𝟏.𝟕𝟒𝟗𝟒
3.Fit a parabola to the following data, also estimate y at x=6
x: 1 2 3 4 5
y 5 12 26 60 97
Solution:
To fit a second degree curve 𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐to a given data, the normal
equations are:
∑ 𝑦 = 𝑎 ∑ 𝑥 2 + 𝑏 ∑ 𝑥 + 𝑛𝑐 − −(1)

∑ 𝑥𝑦 = 𝑎 ∑ 𝑥 3 + 𝑏 ∑ 𝑥 2 + 𝑐 ∑ 𝑥 — (2)
2
∑ 𝑥 2 𝑦 = 𝑎 ∑ 𝑥 4 + 𝑏 ∑ 𝑥 3 + 𝑐 ∑ 𝑥 − −(3)

We form the the table,


𝑥 𝑦 𝑥2 𝑥3 𝑥4 𝑥𝑦 𝑥2𝑦
1 5 1 1 1 5 5
2 12 4 8 16 24 48
3 26 9 27 81 78 234
4 60 16 64 256 240 960
5 97 25 125 625 485 2425
Total 15 200 55 225 979 832 3672

Hence the equations (1),(2),(3) becomes


55a+15b+5c=200----(4)
225a+55b+15c=832----(5)
979a+225b+55c=3672----(6)
Solving we get a=5.7143,b=-11.0858, c=10.4001.
Hence the parabola is 𝑦 = 5.7143𝑥 2 − 11.0858𝑥 + 10.4001.
y(x=6)=149.6001.

4. Fit a second degree curve to the data:


x: 1929 1930 1931 1932 1933 1934 1935
y: 352 356 357 358 360 361 361
Solution:Let X=x-1932,Y=y-357
To fit a second degree curve 𝑦 = 𝑎𝑋 2 + 𝑏𝑋 + 𝑐 to a given data, the normal
equations are:
∑ 𝑌 = 𝑎 ∑ 𝑥 2 + 𝑏 ∑ 𝑋 + 𝑛𝑐 − −(1)

∑ 𝑋𝑌 = 𝑎 ∑ 𝑋 3 + 𝑏 ∑ 𝑋 2 + 𝑐 ∑ 𝑋 — (2)
2
∑ 𝑋 2 𝑌 = 𝑎 ∑ 𝑋 4 + 𝑏 ∑ 𝑋 3 + 𝑐 ∑ 𝑋 − −(3)

We form the the table,


𝑥 𝑦 X Y 𝑋2 𝑋3 𝑋4 𝑋𝑌 𝑋2𝑌
1929 352 -3 -5 9 -27 81 15 -45
1930 356 -2 -1 4 -8 16 2 -4
1931 357 -1 0 1 -1 1 0 0
1932 358 0 1 0 0 0 0 0
1933 360 1 3 3 1 1 3 3
1934 361 2 4 4 8 16 8 16
1935 361 3 4 4 27 81 12 36

Total 0 6 28 0 196 40 6
Hence the normal equations are 28a+7c=6
28b=40
196a+28c=6
Therefore a=-0.21429, b=1.4286, c=1.7143
The equation is Y=-0.21429𝑋 2 +1.4286X+1.7143
(i.e) y-357=-0.21429(x − 1932)2 +1.7143+1.4286(x-1932)
(i.e) y=-0.21429𝑥 2 +829.445x-802265.33

Practice problems
1. Fit a straight line to the following data and find the value of y when x
= 3.5
x: 1 2 3 4 5 6
y: 0.5 2.5 2.0 4.0 3.5 6.0
2. Fit a parabola to the following data:
x: 0 1 2 3 4
y 1 1.8 1.3 2.5 6.3
3. Fit a second degree curve to the data:
x: 1 2 3 4 5 6 7 8 9
y: 2 6 7 8 10 11 11 10 9

4. Fit a curve of the form 𝑦 = 𝑎𝑏 𝑥 to the data:


x: 1 2 3 4 5 6
y: 151 100 61 50 20 8

5. From the table given below, find the best values of 𝑎and𝑏 in the law 𝑦 =
𝑎𝑒 𝑏𝑥 by the method of least squares:
x: 0 5 8 12 20
y: 3.0 1.5 1.0 0.55 0.18

6. Given the following data:


x: 0 1 2 3 4
y: 1 5 10 22 38

Fit the straight line and parabola of best fit and calculate the sum of the
squares of the residuals in both cases. Which curve is more appropriate
and why?
Interpolation
Given a set of values (𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 0,1,2, . . . . 𝑛, the process of finding the values
of 𝑦 corresponding to non-tabulated values of 𝑥, is called interpolation. In
particular, if 𝑥0 < 𝑥 < 𝑥𝑛 , then the process is called interpolation, and if
𝑥 < 𝑥0or𝑥 > 𝑥𝑛 , then it is called extrapolation. We approximate the
function 𝑦 = 𝑓(𝑥) by polynomials, called interpolating polynomials.

Forward differences
𝛥𝑦0 = 𝑦1 − 𝑦0
𝛥𝑦1 = 𝑦2 − 𝑦1
.......................
𝛥𝑦𝑛−1 = 𝑦𝑛 − 𝑦𝑛−1 are called the first order forward differences of 𝑦.
𝛥is called the forward difference operator.

The differences of the first order differences are called the second order
forward differencesand the differences of the second order differences are
called the third order forward differences
𝛥2 𝑦0 = 𝛥𝑦1 − 𝛥𝑦0 𝛥3 𝑦0 = 𝛥2 𝑦1 − 𝛥2 𝑦0
𝛥2 𝑦1 = 𝛥𝑦2 − 𝛥𝑦1 𝛥3 𝑦1 = 𝛥2 𝑦2 − 𝛥2 𝑦1
....................... .......................
𝛥2 𝑦𝑛−2 = 𝛥𝑦𝑛−1 − 𝛥𝑦𝑛−2 𝛥2 𝑦𝑛−3 = 𝛥𝑦𝑛−2 − 𝛥𝑦𝑛−3
Backward differences
𝛻𝑦1 = 𝑦1 − 𝑦0
𝛻𝑦2 = 𝑦2 − 𝑦1
.......................
𝛻𝑦𝑛 = 𝑦𝑛 − 𝑦𝑛−1 are called the first order backward differences of 𝑦.
𝛻is called the forward difference operator.

The second order and third order backward differences are


𝛻 2 𝑦2 = 𝛻𝑦2 − 𝛻𝑦1 𝛻 3 𝑦3 = 𝛻 2 𝑦3 − 𝛻 2 𝑦2
𝛻 2 𝑦3 = 𝛻𝑦3 − 𝛻𝑦2 𝛻 3 𝑦4 = 𝛻 2 𝑦4 − 𝛻 2 𝑦3
....................... . . . . . . . . . . . . . . . . . . . . . ..

Interpolation with equal intervals


Newton’s forward interpolation formula
Let 𝑥0 , 𝑥1, . . . . . . 𝑥𝑛 be equidistant values of 𝑥, and
𝑦0 , 𝑦1 , . . . . . . 𝑦𝑛 be the corresponding values of 𝑦 = 𝑓(𝑥). Let ℎ = 𝑥𝑖 − 𝑥𝑖−1 , 𝑖 =
𝑥−𝑥0 𝑢 𝑢(𝑢−1)
1,2, . . . . 𝑛and 𝑢 = . Then𝑦 = 𝑦0 + 1! 𝛥𝑦0 + 𝛥2 𝑦0 +
ℎ 2!
𝑢(𝑢−1)(𝑢−2)
𝛥3 𝑦0 +. . . . . . . . ..
3!

When only two pairs of values (𝑥0 , 𝑦0 ), (𝑥1, 𝑦1 ) are given, the formula is
called linear interpolation formula and it reduces to the two- point
equation of a straight line.
When three pairs of values (𝑥0 , 𝑦0 ), (𝑥1 , 𝑦1 ), (𝑥2 , 𝑦2 ) are given, we get
parabolic interpolation formula.
Newton’s backward interpolation formula
Let 𝑥0 , 𝑥1, . . . . . . 𝑥𝑛 be equidistant values of 𝑥, and
𝑦0 , 𝑦1 , . . . . . . 𝑦𝑛 be the corresponding values of 𝑦 = 𝑓(𝑥).
𝑥−𝑥𝑛 𝑣 𝑣(𝑣+1)
Let ℎ = 𝑥𝑖 − 𝑥𝑖−1 , 𝑖 = 1,2, . . . . 𝑛and 𝑣 = . Then𝑦 = 𝑦𝑛 + 1! 𝛻𝑦𝑛 + 𝛻 2 𝑦𝑛 +
ℎ 2!
𝑣(𝑣+1)(𝑣+2)
𝛻 3 𝑦𝑛 +. . . . . . ..
3!

Note: Both Newton’s forward and backward formulas give the same
value at any point and the interpolating polynomials are also the same.
However, the forward difference formula is used for interpolating or
extrapolating near the beginning of the table and the backward difference
formula is used interpolating or extrapolating near the end of the table.

Example 1
1. Find the cubic polynomial which takes the follows the following values:
𝑥 :0 1 2 3
𝑓(𝑥): 1 2 1 10
Hence find 𝑓(4).
Solution: We form the difference table:
𝑥 𝑦 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦
0 1
1
1 2 -2
-1 12
2 1 10
9
3 10
𝑥 − 𝑥0 𝑥 − 0
𝑢= = =𝑥
ℎ 1
By Newton’s forward interpolation formula,
𝑢 𝑢(𝑢 − 1) 2 𝑢(𝑢 − 1)(𝑢 − 2) 3
𝑦 = 𝑦0 + 𝛥𝑦0 + 𝛥 𝑦0 + 𝛥 𝑦0 +. . . . . . . .
1! 2! 3!
𝑥(𝑥 − 1) 𝑥(𝑥 − 1)(𝑥 − 2)
= 1 + 𝑥(1) + (−2) + (12)
2 6
= 1 + 𝑥 − 𝑥 2 + 𝑥 + 2𝑥 3 − 6𝑥 2 + 4𝑥
= 2𝑥 3 − 7𝑥 2 + 6𝑥 + 1
∴ 𝑓(𝑥) = 2𝑥 3 − 7𝑥 2 + 6𝑥 + 1
∴ 𝑓(4) = 2(43 ) − 7(42 ) + 6(4) + 1
= 41
2.The population of a city taken once in ten years is given below.
Estimate thepopulation in the year 1955.

Year: 1951 1961 1971 1981


Populations in thousands: 35 42 58 84

Solution:
𝑥 𝑦 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦
1951 35
7
1961 42 9
16 1
1971 58 10
26
1981 84

𝑥−𝑥0 1955−1951
𝑢=𝑢 = = 0.4By Newton’s forward interpolation formula,𝑦
ℎ 10

u u(u − 1) 2 u(u − 1)(u − 2) 3


= y0 + Δy0 + Δ y0 + Δ y0 +. . . . . . . .
1! 2! 3!
(0.4)(0.4 − 1) (0.4)(0.4 − 1)(0.4 − 2)
= 35 + (0.4)(7) + (9) + (1)
2 6
(0.4)(−0.6) (0.4)(−0.6)(−1.6)
= 35 + (0.4)(7) + (9) + (1)
2 6
= 36.784thousands

3.Find the value of y at x=21 and x=28 from the following data:
x : 20 23 26 29
y : 0.3420 0.3907 0.4384 0.4848
Solution:Since x=21 is nearer to the beginning of the table, we use
Newton’s forward formula.We form the difference table. Also
h=constant=3.
𝑥x 𝑦𝑦 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦
20 0.3420
0.0487
23 0.3907 -0.0010
0.0477 -0.0003
26 0.4384 -0.0013
0.0464
29 0.4848

The topmost diagonal gives the forward differences of y0 while the


lowermost diagonal gives the backward differences of yn.
There are only 4 data given. Hence the polynomial will be of degree 3.
By Newton’s forward interpolation formula,
u(u − 1) 2 u(u − 1)(u − 2) 3
Pn (x) = y(x) = y0 + uΔy0 + Δ y0 + Δ y0 +. . . . . .
2! 3!
u(u − 1)(u − 2). . . . (u − (n − 1)) n
+ Δ y0
n!
x − x0
𝑊here u = , h → differencebetweenany2con sec u tivexvalues
h
x − x0 21 − 20
= = = 0.3333.
h 3
(0.3333)(−0.6666)
𝑦y(21) = 0.3420 + (0.3333)(0.0487) + (−0.001)
2
(0.3333)(−0.6666)(−1.6666)
+ (−0.0003)
6
y (21) ≈0.3583
Since x=28 is nearer to end value, we use Newton’s backward
interpolation formula.
v(v + 1) 2 v(v + 1)(v + 2) 3
y(x) = yn + v∇yn + ∇ yn + ∇ yn +. . . . . .
2! 3!
v(v + 1)(v + 2). . . . (v + (n − 1)) 𝑛
+ 𝛻 𝑦𝑛
n!
x − xn
𝑊here v = , h → difference between any 2 con sec u tive x values
h
x − xn 28 − 29 −1
𝑣𝑣 = = =
h 3 3
−1 2 −1 2 5
−1 ( )( ) ( )( )( )
𝑦(28) = 0.4848 + ( ) (0.0464) + 3 3 (−0.0013) + 3 3 3 (−0.0003)+. . . ..
3 2 6
=0.4848-0.015465+0.0001444+0.0000185 ,y(28) ≈0.4695.
4. From the data given below, find the number of students whose weight
is between 60 and 70.
Weight in lbs : 0-40 40-60 60-80 80-100 100-120
No. of students : 250 120 100 70 50
Solution:

Weight (x) No.of 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦 𝛥4 𝑦


students
(𝑦)

Below 40 250
120
Below 60 370 -20
100 -10
Below 80 470 -30 20
70 10
Below 100 540 -20
50
Below 120 590

Let us calculate the number of students whose weight is less than


70.We will use forward difference formula
𝒙 − 𝒙𝟎 𝟕𝟎 − 𝟒𝟎
𝒖= = = 𝟏. 𝟓
𝒉 𝟐𝟎
𝒖(𝒖 − 𝟏) 𝟐
𝒚(𝟕𝟎) = 𝒚𝟎 + 𝒖𝜟𝒚𝟎 + 𝜟 𝒚𝟎 +. . .
𝟐
(𝟏. 𝟓)(𝟎. 𝟓) (𝟏. 𝟓)(𝟎. 𝟓)(−𝟎. 𝟓)
= 𝟐𝟓𝟎 + (𝟏. 𝟓)(𝟏𝟐𝟎) + (−𝟐𝟎) + (−𝟏𝟎)
𝟐 𝟔
(𝟏. 𝟓)(𝟎. 𝟓)(−𝟎. 𝟓)(−𝟏. 𝟓)
+ (𝟐𝟎) = 𝟐𝟓𝟎 + 𝟏𝟖𝟎 − 𝟕. 𝟓 + 𝟎. 𝟔𝟐𝟓 + 𝟎. 𝟒𝟔𝟖𝟕
𝟐𝟒
= 𝟒𝟐𝟑. 𝟓𝟗 ≈ 𝟒𝟐𝟒
Number of students whose weight is between 60 and 70 = 𝒚(𝟕𝟎) −
𝒚(𝟔𝟎) = 𝟒𝟐𝟒 − 𝟑𝟕𝟎 = 𝟓𝟒.
5 . From the following table of half-yearly premium for policies maturing
at different ages, estimate the premium for policies maturing at age 46
and 63.
Age x: 45 50 55 60 65
Premium y: 114.84 96.16 83.32 74.48 68.48
Solution: Since five datas are given, the interpolating polynomial will be
of degree four.
To find y (46), we use forward interpolation formula while to get y(63),
we use Newton’s backward difference interpolation formula.
The values of x are equally spaced, h=5.

x y 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦 𝛥4 𝑦

45 114.84
-18.68
50 96.16 5.84
-12.84 -1.84
55 83.32 4 0.68
-8.84 -1.16
60 74.48 2.84
-6
65 68.48

𝑥 − 𝑥0 46 − 45 1
𝑢= = =
ℎ 5 5
y (46) = 114.84-3.7360-0.4672-0.08832-0.0228
y (46) = 110.52568
𝑥 − 𝑥𝑛 63 − 65 −2
𝑣= = =
ℎ 5 5
y (63) = 68.48+2.40-0.3408+0.07424-0.028288
y (63)=70.585152.

6. Find a polynomial of degree four which takes the values

x: 2 4 6 8 10
y: 0 0 1 0 0

Solution :
Let us form the difference table.
x y 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦 𝛥4 𝑦
2 0
0
4 0 1
1 -3
6 1 -2 6
-1 3
8 0 1
0
10 0

Let us find the polynomial using Newton’s forward interpolation


formula.
x − x0 x − 2
u= =
h 2 𝒖(𝒖 − 𝟏) 𝟐 𝒖(𝒖 − 𝟏)(𝒖 − 𝟐) 𝟑
𝒚(𝒙) = 𝒚𝟎 + 𝒖𝜟𝒚𝟎 + 𝜟 𝒚𝟎 + 𝜟 𝒚𝟎 +. . . . .
𝟐 𝟔
𝒙−𝟐 𝒙−𝟒 𝒙−𝟐 𝒙−𝟒 𝒙−𝟔 𝒙−𝟐 𝒙−𝟒 𝒙−𝟔 𝒙−𝟖
( 𝟐 )( 𝟐 ) ( 𝟐 )( 𝟐 )( 𝟐 ) ( 𝟐 )( 𝟐 )( 𝟐 )( 𝟐 ) (𝒙−𝟐)(𝒙−𝟒)
= 𝟎 + 𝒖(𝟎) + (𝟏) + (−𝟑) + (𝟔).= [𝟏 −
𝟐 𝟔 𝟐𝟒 𝟖
𝟏 𝟏
(𝒙 − 𝟐) + 𝟖 (𝒙 − 𝟔)(𝒙 − 𝟖)]
𝟐

𝟏
=𝟔𝟒 (𝒙 − 𝟐)(𝒙 − 𝟒)[𝟖 − 𝟒𝒙 + 𝟐𝟒 + 𝒙𝟐 − 𝟏𝟒𝒙 + 𝟒𝟖]
𝟏
= [𝒙𝟒 − 𝟐𝟒𝒙𝟑 + 𝟏𝟗𝟔𝒙𝟐 − 𝟔𝟐𝟒𝒙 + 𝟔𝟒𝟎]
𝟔𝟒

7.Find the missing value of the following table:


x:0 1 2 3 4
y:1 2 4 - 16.
Solution:
x y 𝛥𝑦 𝛥2 𝑦 𝛥3 𝑦 𝛥4 𝑦
0 1
1
1 2 1
2 a-7
2 4 a-6 -4a+33
a-4 26-3a
3 a 20-2a
16-a
4 16

𝛥4 𝑦 = 0,then-4a=-33 implies a=8.25

Interpolation with unequal intervals


1. Newton’s divided difference formula
2. Lagrange’s interpolation formula
3. Lagrange’s inverse interpolation formula

Divided differences⏃

Consider the arguments 𝑥0 , 𝑥1 , 𝑥2 , . . . . . . . . . . , 𝑥𝑛 which may or may not be


equally spaced. Let the corresponding values of 𝑦 = 𝑓(𝑥) be
𝑓(𝑥0), 𝑓(𝑥1 ), 𝑓(𝑥2 ), . . . . . . . . . . 𝑓(𝑥𝑛 ). Then the divided differences of various
orders are defined as follows:
⏃𝑓(𝑥0 ) = [𝑥0, 𝑥1 ] = 𝑓(𝑥0 , 𝑥1 )
x1
𝒇(𝒙𝟏 ) − 𝒇(𝒙𝟎 )
𝒇(𝒙𝟎 , 𝒙𝟏 ) =
𝒙𝟏 − 𝒙𝟎
𝒇(𝒙𝟐 ) − 𝒇(𝒙𝟏 )
𝒇(𝒙𝟏 , 𝒙𝟐 ) =
𝒙𝟐 − 𝒙𝟏
……………………………..
𝒇(𝒙𝒓 ) − 𝒇(𝒙𝒓−𝟏 )
𝒇(𝒙𝒓−𝟏 , 𝒙𝒓 ) = for 𝒓 = 𝟏, 𝟐, . . . 𝒏
𝒙𝒓 − 𝒙𝒓−𝟏
Similarly second order, third order and higher order differences are
𝒇(𝒙𝟏 ,𝒙𝟐 )−𝒇(𝒙𝟎 ,𝒙𝟏)
defined. For example,𝒇(𝒙𝟎 , 𝒙𝟏 , 𝒙𝟐 ) = 𝒙𝟐 −𝒙𝟎

𝒇(𝒙𝟏 ,𝒙𝟐 ,𝒙𝟑 )−𝒇(𝒙𝟎 ,𝒙𝟏 ,𝒙𝟐)


𝒇(𝒙𝟎 , 𝒙𝟏 , 𝒙𝟐 , 𝒙𝟑 ) = etc.
𝒙𝟑 −𝒙𝟎

Properties of divided differences:

1. The divided difference operator⏃ is linear. i.e.,𝛥(𝑎𝑓(𝑥) + 𝑏𝑔(𝑥)) =


𝑎𝛥𝑓(𝑥) + 𝑏𝛥𝑔(𝑥)
2. The 𝑛 𝑡ℎ order divided differences of a polynomial of degree 𝑛are
constant, equal to the coefficient of 𝑥 𝑛 .
3. Conversely, if the 𝑛 𝑡ℎ order divided differences of a polynomial are
constants, then the polynomial is of degree 𝑛.

Problems

1 1
1.if 𝑓(𝑥) = 𝑥 . 𝑓𝑖𝑛𝑑 𝑡ℎ𝑒 𝑑𝑖𝑣𝑖𝑑𝑒𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑜𝑓 𝑓(𝑎, 𝑏, 𝑐, 𝑑)𝑜𝑟 𝑠ℎ𝑜𝑤 𝑡ℎ𝑎𝑡 ∆3𝑏𝑐𝑑 (𝑎) =
1
− (𝑎𝑏𝑐𝑑 )

1 1 1
Solution : Given 𝑓(𝑥) = 𝑥 𝑡ℎ𝑒𝑛 𝑓(𝑎) = 𝑎 , 𝑓(𝑏) = 𝑏
1 1 𝑎−𝑏
𝑓(𝑏) − 𝑓(𝑎) 𝑏 − 𝑎
𝑓(𝑎, 𝑏) = = = 𝑎𝑏
𝑏−𝑎 𝑏−𝑎 𝑏−𝑎

−1
𝑓(𝑎, 𝑏) =
𝑎𝑏

𝑓(𝑏, 𝑐) − 𝑓(𝑎, 𝑏)
𝑓(𝑎, 𝑏, 𝑐) =
𝑐−𝑎

−1 (−1) −𝑎𝑏+𝑏𝑐
− 𝑏(𝑎𝑐𝑏)
𝑏𝑐 𝑎𝑏
𝑓(𝑎, 𝑏, 𝑐) = =
𝑐−𝑎 𝑐−𝑎
𝑏(−𝑎+𝑐)
𝑏(𝑎𝑐𝑏) 1
𝑓(𝑎, 𝑏, 𝑐) = =
𝑐−𝑎 𝑎𝑏𝑐

Similarly
𝑓(𝑏, 𝑐, 𝑑) − 𝑓(𝑎, 𝑏, 𝑐) −1
𝑓(𝑎, 𝑏, 𝑐, 𝑑) = =
𝑑−𝑎 𝑎𝑏𝑐𝑑

2. Obtain the divided difference table for the following data:


𝑥 : -1 1 2 3
𝑓(𝑥) : -21 15 12 3

𝑥 𝑓(𝑥) ⏃𝑓(𝑥) ⏃2𝑓(𝑥) ⏃3𝑓(𝑥)


-1 -21
15 − (−21)
= 18
1 − (−1)
1 15 −3 − 18
2 − (−1)
21
=− = −7
3
12 − 15 −3 + 7
= −3
2−1 3+1
= −1
2 12 −9 − (−3)
3−1
−6
= = −3
2
3 − 12
= −9
3−2
3 3
Newton’s divided difference formula
Let 𝑥0 , 𝑥1 , 𝑥2 , . . . . . . . . . . , 𝑥𝑛 be 𝑛 + 1 arguments which may or may not be
equally spaced. Let the corresponding values of 𝑦 = 𝑓(𝑥)be
𝑓(𝑥0), 𝑓(𝑥1 ), 𝑓(𝑥2 ), . . . . . . . . . . 𝑓(𝑥𝑛 ). Then
𝑓(𝑥) = 𝑓(𝑥0 ) + (𝑥 − 𝑥0 )𝑓(𝑥0 , 𝑥1 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1)𝑓(𝑥0 , 𝑥1 , 𝑥2 )+. . . . . . . . . . . . . . .
+(𝑥 − 𝑥0 )(𝑥 − 𝑥1). . . . . . (𝑥 − 𝑥𝑛−1 )𝑓(𝑥0 , 𝑥1 , 𝑥2 , . . . . . . 𝑥𝑛 )
Problems
1.Find𝑓(𝑥) as a polynomial in 𝑥 from the given data:

𝑥: 3 7 9 10
𝑓(𝑥): 168 120 72 63

Solution:
𝑥 𝑓(𝑥) ⏃𝑓(𝑥) ⏃2𝑓(𝑥) ⏃3𝑓(𝑥)
3 168
120 − 168
7−3
= −12
7 120 −24 − (−12)
9−3
= −2
72 − 120 1
9−7
= −24
9 72 5
63 − 72
= −9
10 − 9
10 63

By Newton’s divided difference formula


𝑓(𝑥) = 𝑓(𝑥0) + (𝑥 − 𝑥0 )𝑓(𝑥0 , 𝑥1 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )𝑓(𝑥0 , 𝑥1 , 𝑥2 ) +
+(𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 )
= 168 + (𝑥 − 3)(−12) + (𝑥 − 3)(𝑥 − 7)(−2) + (𝑥 − 3)(𝑥 − 7)(𝑥 − 9)(1)
= 𝑥 3 − 21𝑥 2 + 119𝑥 − 27
∴ 𝑓(8) = 83 − 21(82 ) + 119(8) − 27

= 93
3.Use Newton’s formula to find 𝑓(𝑥)from the following data and hence find
𝑓(6):

𝑥: 1 2 7 8
𝑦: 1 5 5 4

𝑥 𝑓(𝑥) ⏃𝑓(𝑥) ⏃2𝑓(𝑥) ⏃3𝑓(𝑥)


1 1
4
2 5 -0.6667
0 0.0714
7 5 -0.1667
-1
8 4

𝑓(𝑥) = 𝑓(𝑥0) + (𝑥 − 𝑥0 )𝑓(𝑥0 , 𝑥1 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )𝑓(𝑥0 , 𝑥1 , 𝑥2 ) +


+(𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 )
= 1 + (6 − 1)(4) + (6 − 1)(6 − 2)(−0.6667) + (6 − 1)(6 − 2)(6 − 7)(0.0714)
= 32.9060
Lagrange’s interpolation formula
Let 𝑦0 , 𝑦1 , 𝑦2 , . . . . . . . . . . , 𝑦𝑛 be the values of the function 𝑦 = 𝑓(𝑥)corresponding
to the arguments 𝑥0, 𝑥1 , 𝑥2 , . . . . . . . . . . , 𝑥𝑛 , which are not necessarily equally
spaced (i.e., may or may not be equally spaced). Then
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ). . . . . . (𝑥 − 𝑥𝑛 ) (𝑥 − 𝑥0)(𝑥 − 𝑥2 ). . . . . . (𝑥 − 𝑥𝑛 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦
(𝑥0 − 𝑥1)(𝑥0 − 𝑥2 ). . . . . . (𝑥0 − 𝑥𝑛 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2). . . . . . (𝑥1 − 𝑥𝑛 ) 1
(𝑥 − 𝑥0)(𝑥 − 𝑥1 ). . . . . . (𝑥 − 𝑥𝑛−1 )
+. . . . . . . . . . . 𝑦
(𝑥𝑛 − 𝑥0 )(𝑥𝑛 − 𝑥1). . . . . . (𝑥𝑛 − 𝑥𝑛−1 ) 𝑛

Note:
When 𝑛 = 2,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 𝑥0)(𝑥 − 𝑥2 ) (𝑥 − 𝑥0 )(𝑥 − 𝑥1)
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦1 + 𝑦
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (𝑥1 − 𝑥0)(𝑥1 − 𝑥2 ) (𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) 2
When 𝑛 = 3,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦 +
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1)(𝑥 − 𝑥3 ) (𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑦2 + 𝑦
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (𝑥3 − 𝑥0)(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2) 3

1.Using Lagrange’s interpolation formula, fit a polynomial to the following


data
𝑥: -1 0 2 3
𝑦: -8 3 1 12
and hence find 𝑦 at 𝑥 = 1 and 𝑥 = 1.5.
Solution
Given 𝑥0 = −1, 𝑥1 = 0, 𝑥2 = 2, 𝑥3 = 3,𝑦0 = −8, 𝑦1 = 3, 𝑦2 = 1, 𝑦3 = 12
By Lagrange’s formula,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦 +
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1)(𝑥 − 𝑥3 ) (𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑦2 + 𝑦
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (𝑥3 − 𝑥0)(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2) 3
(𝑥 − 0)(𝑥 − 2)(𝑥 − 3) (𝑥 + 1)(𝑥 − 2)(𝑥 − 3)
= (−8) + (3) +
(−1 − 0)(−1 − 2)(−1 − 3) (0 + 1)(0 − 2)(0 − 3)
(𝑥 + 1)(𝑥 − 0)(𝑥 − 3) (𝑥 + 1)(𝑥 − 0)(𝑥 − 2)
(1) + (12)
(2 + 1)(2 − 0)(2 − 3) (3 + 1)(3 − 0)(3 − 2)
2 3 1 1
= (𝑥 − 5𝑥 2 + 6𝑥) + (𝑥 3 − 4𝑥 2 + 𝑥 + 6) − (𝑥 3 − 2𝑥 2 − 3𝑥) + (𝑥 3 − 𝑥 2 − 2𝑥)
3 2 6
= 2𝑥 3 − 6𝑥 2 + 3𝑥 + 3
∴ 𝑦(1) = 2(1)3 − 6(1)2 + 3(1) + 3 = 2
𝑦(1.5) = 2(1.5)3 − 6(1.5)2 + 3(1.5) + 3 = 0.75

2.Using Lagrange’s interpolation formula, find y(10) from the following


data
𝑥: 5 6 9 11
𝑦: 12 13 14 16
Solution
Given 𝑥0 = 5, 𝑥1 = 6, 𝑥2 = 9, 𝑥3 = 11,𝑦0 = 12, 𝑦1 = 13, 𝑦2 = 14, 𝑦3 = 16
By Lagrange’s formula,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦 +
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1)(𝑥 − 𝑥3 ) (𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑦2 + 𝑦
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (𝑥3 − 𝑥0)(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2) 3

(𝑥 − 6)(𝑥 − 9)(𝑥 − 11) (𝑥 − 5)(𝑥 − 9)(𝑥 − 11)


𝑦 = 𝑓(𝑥) = (12) + (13) +
(5 − 6)(5 − 9)(5 − 11) (6 − 5)(6 − 9)(6 − 11)
(𝑥 − 5)(𝑥 − 6)(𝑥 − 11) (𝑥 − 5)(𝑥 − 6)(𝑥 − 9)
(14) + (16)
(9 − 5)(9 − 6)(9 − 11) (11 − 5)(11 − 6)(11 − 9)

Putting x=10,
(4)(1)(−1) (5)(1)(−1)
𝑦 = 𝑓(10) = (12) + (13) +
(−1)(−4)(−6) (1)(−3)(−5)
(5)(4)(−1) (5)(4)(1)
(14) + (16)
(4)(3)(−2) (6)(5)(2)
=14.6666.

3.Using Lagrange’s formula ,prove that


𝑦1 = 𝑦3 − 0.3(𝑦5 − 𝑦−3 ) + 0.2(𝑦−3 − 𝑦−5)

. Solution:
From the equation ,the values of x are

X0= -5 X1=-3 X2=3 X3=5

Y0=𝑦−5 Y1=𝑦−3 Y2=𝑦3 Y3=𝑦5

By Lagrange’s formula,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦 +
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1)(𝑥 − 𝑥3 ) (𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑦2 + 𝑦
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (𝑥3 − 𝑥0)(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2) 3

(1 + 3)(1 − 3)(1 − 5) (1 + 5)(1 − 3)(1 − 5)


𝑦 = 𝑓(𝑥) = 𝑦−5 + 𝑦 +
(−5 + 3)(−5 − 3)(−5 − 5) (−3 − (−5))(−3 − 3)(−3 − 5) −3

(1 + 5)(1 + 3)(1 − 5) (1 + 5)(1 + 3)(1 − 3)


𝑦3 + 𝑦
(3 + 5)(3 + 3)(3 − 5) (5 + 5)(5 + 3)(5 − 3) 5
𝑦 = 𝑓(𝑥) = −0.2𝑦−5 + 0.5𝑦−3 + 𝑦3 − 0.3𝑦5
𝑦1 = 𝑦3 − 0.3(𝑦5 − 𝑦−3 ) + 0.2(𝑦−3 − 𝑦−5)

3. Using Lagrange’s interpolation formula, find y(9.5) from the following


data
𝑥: 7 8 9 10
𝑦: 3 1 1 9
Solution
Given 𝑥0 = 7, 𝑥1 = 8, 𝑥2 = 9, 𝑥3 = 10,𝑦0 = 3, 𝑦1 = 1, 𝑦2 = 1, 𝑦3 = 9
By Lagrange’s formula,
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦 +
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1)(𝑥 − 𝑥3 ) (𝑥 − 𝑥0)(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝑦2 + 𝑦
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (𝑥3 − 𝑥0)(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2) 3

(9.5 − 8)(9.5 − 9)(9.5 − 10) (9.5 − 7)(9.5 − 9)(9.5 − 10)


𝑦 = 𝑓(9.5) = (3) + (1) +
(7 − 8)(7 − 8)(7 − 10) (8 − 7)(8 − 9)(8 − 10)
(9.5 − 7)(9.5 − 8)(9.5 − 10) (9.5 − 7)(9.5 − 8)(9.5 − 9)
(1) + (9)
(9 − 7)(9 − 8)(9 − 10) (10 − 7)(10 − 8)(10 − 9)

=0.19-0.31+0.938 +2.8125
=3.63
Lagrange’s inverse interpolation formula
Let 𝑥0 , 𝑥1, 𝑥2 , . . . . . . . . . . , 𝑥𝑛 be the values of the function 𝑥 = 𝑓(𝑦)corresponding
to the arguments 𝑦0 , 𝑦1 , 𝑦2 , . . . . . . . . . . , 𝑦𝑛 , which are not necessarily equally
spaced (i.e., may or may not be equally spaced). Then
(𝑦 − 𝑦1 )(𝑦 − 𝑦2 ). . . . . . (𝑦 − 𝑦𝑛 ) (𝑦 − 𝑦0 )(𝑦 − 𝑦2 ). . . . . . (𝑦 − 𝑦𝑛 )
𝑥 = 𝑓(𝑦) = 𝑥0 + 𝑥
(𝑦0 − 𝑦1 )(𝑦0 − 𝑦2 ). . . . . . (𝑦0 − 𝑦𝑛 ) (𝑦1 − 𝑦0 )(𝑦1 − 𝑦2 ). . . . . . (𝑦1 − 𝑦𝑛 ) 1
(𝑦 − 𝑦0 )(𝑦 − 𝑦1 ). . . . . . (𝑦 − 𝑦𝑛−1 )
+. . . . . . . . . . . 𝑥
(𝑦𝑛 − 𝑦0 )(𝑦𝑛 − 𝑦1 ). . . . . . (𝑦𝑛 − 𝑦𝑛−1 ) 𝑛

Problems:
1.Using Lagrange’s inverse interpolation formula, find the value of x
from the following data when y=13.5
𝑥: 93 96.2 100 104.2 108.7
𝑦: 11..38 12.80 14.70 17.07 19.91
Solution
ByLagrange’s inverse interpolation formula
X0=93,x1=96.2, x2=100, x3=104.2, x4=108.7

Y0=11.38, y1=12.80,y2=14.70, y3=17.07, y4=19.91

= 𝑓(𝑦)
(𝑦 − 12.80)(𝑦 − 14.70)(𝑦 − 17.07)(𝑦 − 19.91)
= (93)
(11.38 − 12.80))(11.38 − 14.70)(11.38 − 17.07)(11.38 − 19.91)
(𝑦 − 11.38)(𝑦 − 14.70)(𝑦 − 17.07)(𝑦 − 19.91)
+ (96.2)
(12.80 − 11.38))(12.80 − 14.70)(12.80 − 17.07)(12.80 − 19.91)
(𝑦 − 11.38)(𝑦 − 12.80)(𝑦 − 17.07)(𝑦 − 19.91)
+ (100)
(14.70 − 11.38))(14.70 − 12.80)(14.70 − 17.07)(14.70 − 19.91)
(𝑦 − 11.38)(𝑦 − 12.80)(𝑦 − 14.70)(𝑦 − 19.91)
+ (104.2) +
(17.07 − 11.38))(17.07 − 12.80)(17.07 − 14.70)(17.07 − 19.91)
(𝑦 − 11.38)(𝑦 − 12.80)(𝑦 − 14.70)(𝑦 − 17.07)
(108.7)
(19.91 − 11.38))(19.91 − 12.80)(19.91 − 14.70)(19.91 − 19.91)

Putting y=13.5 and simplifying we get ,


X=-7.8126929+68.3721132+43.595887-7.2733429+0.770084198
=97.6557503
2. Find the age corresponding to the annuity value 13.6 given the table.
Age(𝑥): 30 35 40 45 50
𝐴𝑛𝑛𝑢𝑖𝑡𝑦 𝑣𝑎𝑙𝑢𝑒 (𝑦): 15.914.9 14.1 13.312.5

Solution
(13.6 − 14.9)(13.6 − 14.1)(13.6 − 13.3)(13.6 − 12.5)
𝑥= (30) +
(15.9 − 14.9)(15.9 − 14.1)(15.9 − 13.3)(15.9 − 12.5)
(13.6 − 15.9)(13.6 − 14.1)(13.6 − 13.3)(13.6 − 12.5)
(35) +
(14.9 − 15.9)(14.9 − 14.1)(14.9 − 13.3)(14.9 − 12.5)
(13.6 − 15.9)(13.6 − 14.9)(13.6 − 13.3)(13.6 − 12.5)
(40) +
(14.1 − 15.9)(14.1 − 14.9)(14.1 − 13.3)(14.1 − 12.5)
(13.6 − 15.9)(13.6 − 14.9)(13.6 − 14.1)(13.6 − 12.5)
(45) +
(13.3 − 15.9)(13.3 − 14.9)(13.3 − 14.1)(13.3 − 12.5)
(13.6 − 15.9)(13.6 − 14.9)(13.6 − 14.1)(13.6 − 13.3)
(50)
(12.5 − 15.9)(12.5 − 14.9)(12.5 − 14.1)(12.5 − 13.3)
X(13.6)=43

You might also like