Interpolation
Interpolation
𝑥 1 2 3 4 5 6
𝑓(𝑥) 3 10 29 66 127 218
Calculate
Here we are given an equispaced set of data hence we should construct the
difference table
𝑥 𝑓(𝑥) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
1 3 7 12 6 0 0
2 10 19 18 6 0
3 29 37 24 6
4 66 61 30
5 127 91
6 218
BACKWARD PORTION
FORWARD PORTION
To find the value of 𝑓(𝑥) for any 𝑥 lying in the FORWARD portion of the
table we will make use of NEWTONS FORWARD FORMULA.
To find the value of 𝑓(𝑥) for any 𝑥 lying in the BACKWARD portion of the
table we will make use of NEWTONS BACKWARD FORMULA.
If any point lies outside the range of given set of data then also we select the
formula based on the approximate location of the point. Then this process
will be known as EXTRAPOLATION.
Here we need to find the value of 𝑓 (𝑥 )𝑓𝑜𝑟 𝑥 = 1.5. Now 𝑥 = 1.5 lies
between 𝑥 = 1 & 𝑥 = 2 or in the forward portion of the table so we select
NEWTONS FORWARD FORMULA.
This form is selected for evaluating the functional relation between 𝑥 & 𝑦.
TYPE-2
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑦 = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3𝑦0 + ⋯ …
2! 3!
𝑥−𝑥0
Where 𝑢 = and 𝑥 =
ℎ
𝑡ℎ𝑒 𝑔𝑖𝑣𝑒𝑛 𝑝𝑜𝑖𝑛𝑡 𝑎𝑡 𝑤ℎ𝑖𝑐ℎ 𝑣𝑎𝑙𝑢𝑒 𝑖𝑠 𝑡𝑜 𝑏𝑒 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑒𝑑
𝑥0 < 𝑥 𝑜𝑟 𝑥0 𝑖𝑠 𝑛𝑒𝑎𝑟𝑒𝑠𝑡 𝑡𝑜 𝑥 𝑜𝑟 𝑏𝑜𝑡ℎ 𝑎𝑛𝑑 ℎ = 𝑠𝑡𝑒𝑝 𝑙𝑒𝑛𝑔𝑡ℎ
This form is selected for evaluating the functional values.
Here we will use this form for finding 𝑓 (1.5). Here 𝑥 = 1.5 → 𝑥0 =
𝑥−𝑥0
1, ℎ = 1 hence we get 𝑢 = = 0.5.
ℎ
NOTE: In interpolation in forward formula the value of u is +ve.
Now we look into the difference table for finding 𝑦0 , ∆𝑦0 , ∆2 𝑦0 , ∆3 𝑦0 . Here
𝑥0 is the first element in the column of x so we select all the first elements of
the successive columns and they will be
𝑦0 = 3, ∆𝑦0 = 7, ∆2𝑦0 = 12, ∆3𝑦0 = 6
Hence using all the values in the formula and simplifying we get,
(0.5)(0.5 − 1) (0.5)(0.5 − 1)(0.5 − 2)
𝑦 = 3 + (0.5) × 7 + × 12 + ×6
2 6
𝑦 = 3 + 3.5 − 1.5 + 0.375 = 5.375
Hence 𝑓(1.5) = 5.375
Here ∆4𝑦0 and other higher orders are zero so we consider the formula up to ∆3 𝑦0
Here we need to find the value of 𝑓(𝑥 )𝑓𝑜𝑟 𝑥 = 2.1. Now 𝑥 = 2.1 lies
between 𝑥 = 2 & 𝑥 = 3 or in the forward portion of the table so we select
NEWTONS FORWARD FORMULA.
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑦 = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3𝑦0 + ⋯ …
2! 3!
𝑥−𝑥0
Where 𝑢 = and 𝑥 =
ℎ
𝑡ℎ𝑒 𝑔𝑖𝑣𝑒𝑛 𝑝𝑜𝑖𝑛𝑡 𝑎𝑡 𝑤ℎ𝑖𝑐ℎ 𝑣𝑎𝑙𝑢𝑒 𝑖𝑠 𝑡𝑜 𝑏𝑒 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑒𝑑
𝑥0 < 𝑥 𝑜𝑟 𝑥0 𝑖𝑠 𝑛𝑒𝑎𝑟𝑒𝑠𝑡 𝑡𝑜 𝑥 𝑜𝑟 𝑏𝑜𝑡ℎ 𝑎𝑛𝑑 ℎ = 𝑠𝑡𝑒𝑝 𝑙𝑒𝑛𝑔𝑡ℎ
𝑥−𝑥0
Here 𝑥 = 2.1 → 𝑥0 = 2, ℎ = 1 hence we get 𝑢 = = 0.1
ℎ
Here 𝑥0 is the second element in the column of x so we select all the second
elements of the successive columns and they will be
𝑦0 = 10, ∆𝑦0 = 19, ∆2𝑦0 = 18, ∆3𝑦0 = 6
Hence using all the values in the formula and simplifying we get,
(0.1)(0.1 − 1) (0.1)(0.1 − 1)(0.1 − 2)
𝑦 = 10 + (0.1) × 7 + × 12 + ×6
2 6
𝑦 = 10 + 0.7 − 0.54 + 0.171 = 10.331
This is the problem of EXTRAPOLATION. But here the point 𝑥 = 0.9 lies
in the FORWARD part of the table and so we will make use of NEWTONS
FORWARD FORMULA.
𝑥−𝑥0
Here 𝑥 = 0.9 , 𝑥0 = 1, ℎ = 1 hence we get 𝑢 = = −0.1
ℎ
Here 𝑥0 is the first element in the column of x so we select all the first
elements of the successive columns and they will be
𝑦0 = 3, ∆𝑦0 = 7, ∆2𝑦0 = 12, ∆3𝑦0 = 6
Hence using all the values in the formula and simplifying we get,
(−0.1)(−0.1−1) (−0.1)(−0.1−1)(−0.1−2)
𝑦 = 3 + (−0.1) × 7 + × 12 + ×6
2 6
𝑦 = 3 − 0.7 + 0.66 − 0.231 = 2.729
Hence 𝑓(0.9) = 2.729
Here we need to find the value of 𝑓(𝑥 )𝑓𝑜𝑟 𝑥 = 5.7. Now 𝑥 = 5.7 lies
between 𝑥 = 5 & 𝑥 = 6 or in the backward portion of the table so we select
NEWTONS BACKWARD FORMULA.
NEWTONS BACKWARD FORMULA
TYPE-1
This form is selected for evaluating the functional relation between 𝑥 & 𝑦.
TYPE-2
𝑢(𝑢+1) 𝑢(𝑢+1)(𝑢+2)
𝑦 = 𝑦𝑛 + 𝑢∇𝑦𝑛 + ∇2𝑦𝑛 + ∇3𝑦𝑛 + ⋯ …
2! 3!
𝑥−𝑥𝑛
Where 𝑢 = and 𝑥 =
ℎ
𝑡ℎ𝑒 𝑔𝑖𝑣𝑒𝑛 𝑝𝑜𝑖𝑛𝑡 𝑎𝑡 𝑤ℎ𝑖𝑐ℎ 𝑣𝑎𝑙𝑢𝑒 𝑖𝑠 𝑡𝑜 𝑏𝑒 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑒𝑑
𝑥𝑛 > 𝑥 𝑜𝑟 𝑥𝑛 𝑖𝑠 𝑛𝑒𝑎𝑟𝑒𝑠𝑡 𝑡𝑜 𝑥 𝑜𝑟 𝑏𝑜𝑡ℎ 𝑎𝑛𝑑 ℎ = 𝑠𝑡𝑒𝑝 𝑙𝑒𝑛𝑔𝑡ℎ
This form is selected for evaluating the functional values.
𝑥−𝑥𝑛
Here 𝑥 = 5.7 → 𝑥𝑛 = 6, ℎ = 1 hence we get 𝑢 = = −0.3.
ℎ
Now we look into the difference table for finding 𝑦𝑛 , ∇𝑦𝑛 , ∇2𝑦𝑛 , ∇3 𝑦𝑛 . Here
𝑥𝑛 is the last element in the column of x so we select all the last elements of
the successive columns and they will be
𝑦𝑛 = 218, ∇𝑦𝑛 = 91, ∇2𝑦𝑛 = 30, ∇3𝑦𝑛 = 6
Hence using all the values in the formula and simplifying we get,
(−0.3)(−0.3+1) (−0.3)(−0.3+1)(−0.3+2)
𝑦 = 218 + (−0.3) × 91 + × 30 + ×6
2 6
𝑦 = 218 − 27.3 − 3.15 − 0.357 = 187.193
Hence 𝑓(5.7) = 187.193
Here ∆4𝑦0 and other higher orders are zero so we consider the formula up to ∆3 𝑦0
This is the problem of EXTRAPOLATION. But here the point 𝑥 = 6.1 lies
in the BACKWARD part of the table and so we will make use of
NEWTONS BACKWARD FORMULA.
𝑥−𝑥𝑛
Here 𝑥 = 6.1 → 𝑥𝑛 = 6, ℎ = 1 hence we get 𝑢 = = 0.1
ℎ
Here 𝑥𝑛 is the last element in the column of x so we select all the first
elements of the successive columns and they will be
𝑦𝑛 = 218, ∇𝑦𝑛 = 91, ∇2 𝑦𝑛 = 30, ∇3 𝑦𝑛 = 6
Hence using all the values in the formula and simplifying we get,
(0.1)(0.1 + 1) (0.1)(0.1 + 1)(0.1 + 2)
𝑦 = 218 + (0.1) × 91 + × 30 +
2 6
×6
𝑦 = 218 + 9.1 + 1.65 + 0.231 = 228.981
CASE-6: To find 𝑓 (𝑥 )
𝑦 = 3 + 7𝑥 − 7 + 6𝑥 2 − 18𝑥 + 12 + 𝑥 3 − 3𝑥 2 + 2𝑥 − 3𝑥 2 + 9𝑥 − 6
𝑦 = 𝑥3 + 2
𝑥 1 2 3 4 5 6
𝑓(𝑥) 3 10 29 66 127 218
Ex-2) Calculate the value of tan(0.12) from the given set of data.
The valued of 𝑥 are equispaced and we need to calculate the value for 𝑥 = 0.12 so
we will construct the difference table and apply the NEWONS FORWARD
FORMULA.
𝑥 𝑓(𝑥) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
0.30 0.3093
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2) 𝑢(𝑢−1)(𝑢−2)(𝑢−3)
𝑦 = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3𝑦0 + ∆4𝑦0
2! 3! 4!
Here we will use this form for finding 𝑓 (0.12). Here 𝑥 = 0.12 → 𝑥0 =
𝑥−𝑥0
0.10, ℎ = 0.05 hence we get 𝑢 = = 0.4.
ℎ
NOTE: In interpolation in forward formula the value of u is +ve.
Now we look into the difference table for finding 𝑦0 , ∆𝑦0 , ∆2 𝑦0 , ∆3 𝑦0 , ∆4𝑦0 .
Here 𝑥0 is the first element in the column of x so we select all the first
elements of the successive columns and they will be
𝑦0 = 0.1003, ∆𝑦0 = 0.0508, ∆2 𝑦0 = 0.0008, ∆3 𝑦0 =
0.0002, ∆4𝑦0 = 0.0002
Hence using all the values in the formula and simplifying we get,
(0.4)(0.4 − 1)
𝑦 = 0.1003 + (0.4) × 0.0508 + × 0.0008
2
(0.4)(0.4 − 1)(0.4 − 2)
+ × 0.0002
6
(0.4)(0.4 − 1)(0.4 − 2)(0.4 − 3)
+ × 0.0002
24
𝑦 = 0.120529 = 0.1205
Hence 𝑓(0.12) = 0.1205
Here ∆5𝑦0 and other higher orders are absent so we consider the formula up to
∆4𝑦0
Ex-3) Calculate the value of 𝑙𝑜𝑔2.91 from the given set of data.
The valued of 𝑥 are equispaced and we need to calculate the value for 𝑥 = 2.91 so
we will construct the difference table and apply the NEWONS BACKWARD
FORMULA.
𝑥 𝑓(𝑥) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
𝑢(𝑢+1) 𝑢(𝑢+1)(𝑢+2)
𝑦 = 𝑦𝑛 + 𝑢∇𝑦𝑛 + ∇2𝑦𝑛 + ∇3𝑦𝑛
2! 3!
𝑥−𝑥𝑛
Here 𝑥 = 2.91 → 𝑥𝑛 = 3, ℎ = 0.2 hence we get 𝑢 = = −0.45.
ℎ
Now we look into the difference table for finding 𝑦𝑛 , ∇𝑦𝑛 , ∇2𝑦𝑛 , ∇3 𝑦𝑛 . Here
𝑥𝑛 is the last element in the column of x so we select all the last elements of
the successive columns and they will be
𝑦𝑛 = 0.47721, ∇𝑦𝑛 = 0.03005, ∇2𝑦𝑛 = −0.0021, ∇3𝑦𝑛 = 0.0005
Hence using all the values in the formula and simplifying we get,
(−0.45)(−0.45+1)
𝑦 = 0.47721 + (−0.45) × 0.03005 − × 0.0021 +
2
(−0.45)(−0.45+1)(−0.45+2)
× 0.0005
6
𝑦 = 0.45907 𝑂𝑅 log(2.91) = 0.45907
Hence 𝑓(5.7) = 187.193
INTERPOLATION FORMULAS FOR NON EQUISPACED POINTS
𝑥 𝑥0 𝑥1 𝑥2 𝑥3 𝑥4
𝑦 𝑦0 𝑦1 𝑦2 𝑦3 𝑦4
Here the difference between the values of the variable 𝑥 are not equal. Hence here
for finding the value of 𝑦 for any given 𝑥 = 𝑎 we cannot use the NEWTON’S
FORWARD or NEWTON’S BACKWARD formula. Then there exists two other
formulas which are applicable for these data types, they are
𝑥 5 6 9 11
𝑦 12 13 14 16
Here if we look into the values of x they are not equidistant so we make use of
lagrangian formula.
Let
𝑥0 = 5, 𝑦0 = 12 ; 𝑥1 = 6, 𝑦1 = 13 ; 𝑥2 = 9, 𝑦2 = 14 ; 𝑥3 = 11, 𝑦3 = 16
Now since four points are given our formula will be of four terms as
(10−6)(10−9)(10−11) (10−5)(10−9)(10−11)
𝑓 (10) = (5−6)(5−9)(5−11)
× 12 +
(6−5)(6−9)(6−11)
× 13 +
(10−5)(10−6)(10−11) (10−5)(10−6)(10−9)
(9−5)(9−6)(9−11)
× 14 + (11−5)(11−6)(11−9) × 16
𝑥 𝑥0 𝑥1 𝑥2 𝑥3 𝑥4
𝑦 𝑦0 𝑦1 𝑦2 𝑦3 𝑦4
1st order divided difference is defined with two points like (𝑥0 , 𝑥1 )
𝒚 −𝒚 𝒚 −𝒚
As 𝒇(𝒙𝟎 , 𝒙𝟏 ) = 𝟎 𝟏 similarly for (𝑥1 , 𝑥2 ) we have (𝒙𝟏 , 𝒙𝟐 ) = 𝟏 𝟐 .
𝒙𝟎 −𝒙𝟏 𝒙𝟏 −𝒙𝟐
2ND order divided difference involve three points like (𝑥0 , 𝑥1 , 𝑥2 ) and is
𝒇(𝒙𝟎 ,𝒙𝟏 )−𝒇(𝒙𝟏 ,𝒙𝟐 )
defined as 𝒇(𝒙𝟎 , 𝒙𝟏 , 𝒙𝟐 ) = where 𝑓 (𝑥0 , 𝑥1 ) & 𝑓 (𝑥1 , 𝑥2 ) are
𝒙𝟎 −𝒙𝟐
calculated by 1ST order divided difference. Similarly for another three points
say (𝑥1 , 𝑥2 , 𝑥3 ) we can calculate another 2ND order difference as
𝒇(𝒙𝟏 ,𝒙𝟐 )−𝒇(𝒙𝟐 ,𝒙𝟑 )
𝒇(𝒙𝟏 , 𝒙𝟐 , 𝒙𝟑 ) = where 𝑓 (𝑥1 , 𝑥2 ) & 𝑓(𝑥2 , 𝑥3 ) are calculated by
𝒙𝟏 −𝒙𝟑
1ST order divided difference.
4th order divided difference can be calculated as, involving five points
𝒇(𝒙𝟎 ,𝒙𝟏 ,𝒙𝟐 ,𝒙𝟑 )−𝒇(𝒙𝟏 ,𝒙𝟐 ,𝒙𝟑 ,𝒙𝟒 )
𝒇(𝒙𝟎 , 𝒙𝟏 , 𝒙𝟐 , 𝒙𝟑 , 𝒙𝟒 ) =
𝒙𝟎 −𝒙𝟒
Since no more points are given we cannot calculate other higher divided
difference.
𝑥0 𝑦0
𝑓(𝑥0 , 𝑥1)
𝑥1 𝑦1 𝑓(𝑥0 , 𝑥1 , 𝑥2 )
𝑓(𝑥1 , 𝑥2 ) 𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 )
𝑓(𝑥2 , 𝑥3 ) 𝑓(𝑥1, 𝑥2 , 𝑥3 , 𝑥4 )
𝑥3 𝑦3 𝑓(𝑥2 , 𝑥3 , 𝑥4 )
𝑓(𝑥3 , 𝑥4 )
𝑥4 𝑦4
𝑥 4 7 9 12
𝑦 −43 83 327 1053
Here
𝑦2 −𝑦3
𝑓 (𝑥2 , 𝑥3 ) = = 242
𝑥2 −𝑥3
𝑥0 = 4 𝑦0 = −43
𝑓 (𝑥0 , 𝑥1 ) = 42 𝑓 (𝑥0 , 𝑥1 , 𝑥2 ) = 16
𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 )
𝑥1 = 7 𝑦1 = 83 𝑓(𝑥1 , 𝑥2 ) = 122 =1
𝑥3 = 12 𝑦3 = 1053
Ex-4) Find the function passing through the set of points and hence find 𝑓(5)
𝑥 2 4 7 8
𝑦 3 43 778 1515
Here
𝑥0 = 2, 𝑦0 = 3 ; 𝑥1 = 4, 𝑦1 = 43 ; 𝑥2 = 7, 𝑦2 = 778 ; 𝑥3 = 8, 𝑦3 = 1515
𝑦2 −𝑦3
𝑓 (𝑥2 , 𝑥3 ) = = 737
𝑥2 −𝑥3
𝑥0 = 2 𝑦0 = 3
𝑓 (𝑥0 , 𝑥1 ) = 20 𝑓 (𝑥0 , 𝑥1 , 𝑥2 ) = 45
𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 ) = 13
𝑥1 = 4 𝑦1 = 43 𝑓(𝑥1 , 𝑥2 ) = 245
𝑓 (𝑥2 , 𝑥3 ) = 737
𝑥2 = 7 𝑦2 = 778
𝑓 (𝑥1 , 𝑥2 , 𝑥3 ) = 123
𝑥3 = 8 𝑦3 = 1515
By divided difference interpolation formula, we get,
𝑥 0 2 3 4 7 8
𝑦 4 26 58 112 466 668
DIFFERENCE TABLE
5th 4th 3rd 2nd 1st 𝑥 𝑦 1st 2nd 3rd 4th 5th
0 4
2 11
2 26
3 7
1
4 32 1
3 58
7 2 11 0
1
8 5 54 1 0
4 112
6 4 16 0
3
5 118 1
7 466
4 21
1 202
8 668
Hence from the table we get
𝑓 (𝑥 ) = 4 + 11𝑥 + (𝑥 2 − 2𝑥 ) × 7 + (𝑥 2 − 2𝑥 )(𝑥 − 3) × 1