Professional Documents
Culture Documents
CHAPTER # 2
INTERPOLATION
&
CURVE FITTING
CHAPTER # 2
PART-I: INTERPOLATION
Introduction:-
In this chapter we will discuss the problem of approximating a given function by a class of
simpler function especially polynomial. Let us suppose a function 𝒚 = 𝒚(𝒙) = 𝒇(𝒙) is not
known explicitly and only the values of 𝒇(𝒙) at a set of points are known.
Let 𝒇(𝒙) is known at the distinct points 𝒙𝟎 , 𝒙𝟏 , 𝒙𝟐 ,...., 𝒙𝒏 i.e.
“Table of values”
Interpolation:-
Interpolation is the process of finding the value of a function for any value of argument or
independent variable in an interval (𝒙𝟎 , 𝒙𝒏 ).
Thus interpolation is the art of reading between the lines in a given table.
Extrapolation:-
Extrapolation is the process of finding the value of a function outside an interval
(𝒙𝟎 , 𝒙𝒏 ).
Theorem:-
Let 𝒚(𝒙) = 𝒇(𝒙) be known at the distinct points 𝒙𝟎 , 𝒙𝟏 , … 𝒙𝒏 . Then there exists a Unique
polynomial 𝑷(𝒙) of Degree less than or equals to 𝒏 and Satisfying the condition:
𝑷(𝒙𝒊 ) = 𝒚(𝒙𝒊 ) = 𝒚𝒊 = 𝒇𝒊 , 𝒊 = 𝟎, 𝟏, 𝟐, … . , 𝒏
𝒙 𝒙𝟎 𝒙𝟏 𝒙𝟐 . .. 𝒙𝒏
𝒚(𝒙) = 𝒇(𝒙) 𝒚𝟎 = 𝒇(𝒙𝟎 ) = 𝒇𝟎 𝒚𝟏 = 𝒇(𝒙𝟏 ) = 𝒇𝟏 𝒚𝟐 = 𝒇(𝒙𝟐 ) = 𝒇𝟐 … 𝒚𝒏 = 𝒇(𝒙𝒏 ) = 𝒇𝒏
where 𝑳𝒊 (𝒙) are called Lagrange’s interpolation coefficients and defined as:
Example # 1:-
Determine the Lagrange’s interpolation polynomial for the data:
𝒙 𝟎 𝟏 𝟑
𝒙𝟎 𝒙𝟏 𝒙𝟐
𝒚 = 𝒇(𝒙) 𝟏 𝟑 𝟓5
𝒚𝟎 𝒚𝟏 𝒚𝟐
Solution :-
The Lagrange’s interpolation polynomial formula of degree at most 2 is given by (here 𝒏 =
𝟐) :
Now
(𝒙−𝒙𝟏 )(𝒙−𝒙𝟐 ) (𝒙−𝟏)(𝒙−𝟑) 𝟏
𝑳𝟎 (𝒙) = (𝒙 = = 𝟑 (𝒙𝟐 − 𝟒𝒙 + 𝟑)
𝟎 −𝒙𝟏 )(𝒙𝟎 −𝒙𝟐 ) (𝟎−𝟏)(𝟎−𝟑)
and
Example # 2:-
Find the missing value from the following data using Lagrange’s interpolation formula:
𝒙 𝟎 𝟏 𝟐 𝟑 𝟒
𝒚(𝒙) = 𝒇(𝒙) −𝟏𝟐 𝟎 − 𝟔 𝟏𝟐
Solution:-
Consider the following data:
𝒙 𝟎 𝟏 𝟑 𝟒
𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒙𝟑
𝒚(𝒙) = 𝒇(𝒙) −𝟏𝟐 𝟎 𝟔 𝟏𝟐
𝒚𝟎 𝒚𝟏 𝒚𝟐 𝒚𝟑
Now
(𝒙 − 𝒙𝟏 )(𝒙 − 𝒙𝟐 )(𝒙 − 𝒙𝟑 ) (𝒙 − 𝟏)(𝒙 − 𝟑)(𝒙 − 𝟒)
𝑳𝟎 (𝒙) = =
(𝒙𝟎 − 𝒙𝟏 )(𝒙𝟎 − 𝒙𝟐 )(𝒙𝟎 − 𝒙𝟑 ) (𝟎 − 𝟏)(𝟎 − 𝟑)(𝟎 − 𝟒)
−𝟏 𝟑
𝑳𝟎 (𝒙) = (𝒙 − 𝟖𝒙𝟐 + 𝟏𝟗𝒙 − 𝟏𝟐)
𝟏𝟐
𝟏 𝟑 𝟏
𝒚 = 𝒇(𝒙) = 𝑷(𝒙) = − (𝒙 − 𝟖𝒙𝟐 + 𝟏𝟗𝒙 − 𝟐)(−𝟏𝟐) + (𝒙𝟑 − 𝟕𝒙𝟐 + 𝟏𝟐𝒙)(𝟎)
𝟏𝟐 𝟔
𝟏 𝟏 𝟑
− (𝒙𝟑 − 𝟓𝒙𝟐 + 𝟒𝒙)(𝟔) + (𝒙 − 𝟒𝒙𝟐 + 𝟑𝒙)(𝟏𝟐)
𝟔 𝟏𝟐
Hence
Example # 3:-
Find 𝒚(𝟏) using Lagrange’s interpolation polynomial:
𝒙 −𝟏 𝟎 𝟐 𝟑
𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒙𝟑
𝒚 = 𝒇(𝒙) 𝟓 𝟐 𝟎 𝟏
𝒚𝟎 𝒚𝟏 𝒚𝟐 𝒚𝟑
Solution:-
The Lagrange’s interpolation polynomial formula of degree at most 3 is given by (here
𝒏 = 𝟑):
𝟑
⟹ 𝒚(𝟏) = 𝒇(𝟏) ≅ 𝑷(𝟏) = ∑𝟑𝒊=𝟎 𝑳𝒊 (𝟏)𝒚𝒊 = 𝑳𝟎 (𝟏)𝒚𝟎 + 𝑳𝟏 (𝟏)𝒚𝟏 + 𝑳𝟐 (𝟏)𝒚𝟐 + 𝑳𝟑 (𝟏)𝒚𝟑 (1)
Now
(𝒙−𝒙𝟏 )(𝒙−𝒙𝟐 )(𝒙−𝒙𝟑 ) (𝟏−𝟎)(𝟏−𝟐)(𝟏−𝟑) 𝟐 −𝟏
𝑳𝟎 (𝟏) = = = =
(𝒙𝟎 −𝒙𝟏 )(𝒙𝟎 −𝒙𝟐 )(𝒙𝟎 −𝒙𝟑 ) (−𝟏−𝟎)(−𝟏−𝟐)(−𝟏−𝟑) −𝟏𝟐 𝟔
𝟏 𝟐 𝟐 𝟏 𝟏
𝒚(𝟏) = 𝒇(𝟏) ≅ 𝑷(𝟏) = (− ) (𝟓) + ( ) (𝟐) + ( ) (𝟎) + (− ) (𝟏) =
𝟔 𝟑 𝟑 𝟔 𝟑
𝑻 0 1 4 5
Current 𝑰 8 11 68 123
Answer:-
𝑰(𝑻) =≈ 𝑷(𝑻) = 𝑻𝟑 − 𝑻𝟐 + 𝟑𝑻 + 𝟖
Let 𝒇(𝒙) and 𝒇′(𝒙) are known at the distinct points 𝒙𝟎 , 𝒙𝟏 , … , 𝒙𝒏 i.e there are (𝟐𝒏 + 𝟐) points
are given as in the following table:
“Table of values”
𝒙 𝒙𝟎 𝒙𝟏 𝒙𝟐 … 𝒙𝒏
𝒚(𝒙) = 𝒇(𝒙) 𝒚𝟎 𝒚𝟏 𝒚𝟐 … 𝒚𝒏
where
where 𝒚′𝒊 and 𝐋′𝒊 (𝒙) are derivatives of 𝒚(𝒙) and 𝑳𝒊 (𝒙) respectively.
Example # 4:-
Using Hermite’s interpolation formula find 𝒚 = 𝒇(𝒙) ≅ 𝑷(𝒙), and obtain 𝒚(𝟎. 𝟓) and
𝒚(−𝟎. 𝟓) from the following table:
𝒙 −𝟏 𝟎 𝟏
𝒙𝟎 𝒙𝟏 𝒙𝟐
𝒚 = 𝒇(𝒙) 𝟏 𝟏 𝟑
𝒚𝟎 𝒚𝟏 𝒚𝟐
𝒚′ = 𝒇′(𝒙) −𝟓 𝟏 𝟕
𝒚′ 𝟎 𝒚′ 𝟏 𝒚′ 𝟐
Solution:-
The Hermite’s interpolation polynomial formula of degree at most 5 is given by(here 𝒏 = 𝟐)
𝟐 𝟐
where
𝑨𝒊 (𝒙) = [𝟏 − 𝟐𝑳′𝒊 (𝒙𝒊 )(𝒙 − 𝒙𝒊 )][𝑳𝒊 (𝒙)]𝟐
we have:
𝒚(𝒙) = 𝒇(𝒙) ≅ 𝑷(𝒙) = 𝑨𝟎 (𝒙)𝒚𝟎 + 𝑨𝟏 (𝒙)𝒚𝟏 + 𝑨𝟐 (𝒙)𝒚𝟐 + 𝑩𝟎 (𝒙)𝒚′ 𝟎 + 𝑩𝟏 (𝒙)𝒚′ 𝟏
+𝑩𝟐 (𝒙)𝒚′𝟐 (1)
(𝒙 − 𝒙𝟏 )(𝒙 − 𝒙𝟐 ) (𝒙 − 𝟎)(𝒙 − 𝟏) 𝟏
𝑳𝟎 (𝒙) = = = 𝒙(𝒙 − 𝟏)
(𝒙𝟎 − 𝒙𝟏 )(𝒙𝟎 − 𝒙𝟐 ) (−𝟏 − 𝟎)(−𝟏 − 𝟏) 𝟐
𝟏 −𝟑
⟹ 𝑳′𝟎 (𝒙) = (𝟐𝒙 − 𝟏) ⟹ 𝑳′𝟎 (𝒙𝟎 ) = 𝑳′𝟎 (−𝟏) =
𝟐 𝟐
(𝒙 − 𝒙𝟎 )(𝒙 − 𝒙𝟐 ) (𝒙 + 𝟏)(𝒙 − 𝟏)
𝑳𝟏 (𝒙) = = = 𝟏 − 𝒙𝟐
(𝒙𝟏 − 𝒙𝟎 )(𝒙𝟏 − 𝒙𝟐 ) (𝟎 + 𝟏)(𝟎 − 𝟏)
(𝒙 − 𝒙𝟎 )(𝒙 − 𝒙𝟏 ) (𝒙 + 𝟏)(𝒙 − 𝟎) 𝟏
𝑳𝟐 (𝒙) = = = 𝒙(𝒙 + 𝟏)
(𝒙𝟐 − 𝒙𝟎 )(𝒙𝟐 − 𝒙𝟏 ) (𝟏 + 𝟏)(𝟏 − 𝟎) 𝟐
𝟏 𝟑
⟹ 𝑳′𝟐 (𝒙) = (𝟐𝒙 + 𝟏) ⟹ 𝑳′𝟐 (𝒙𝟐 ) = 𝑳′𝟐 (𝟏) =
𝟐 𝟐
−𝟑 𝒙𝟐 (𝒙 − 𝟏)𝟐 𝒙𝟐 (𝒙 − 𝟏)𝟐
𝑨𝟎 (𝒙) = [𝟏 − 𝟐 ( ) (𝒙 + 𝟏)] = (𝟒 + 𝟑𝒙)
𝟐 𝟒 𝟒
𝟏
𝑨𝟎 (𝒙) = (𝟑𝒙𝟓 − 𝟐𝒙𝟒 + 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )
𝟒
𝟑 𝒙𝟐 (𝒙 + 𝟏)𝟐 𝒙𝟐 (𝒙 + 𝟏)𝟐
𝑨𝟐 (𝒙) = [𝟏 − 𝟐 ( ) (𝒙 − 𝟏)] = (𝟒 − 𝟑𝒙)
𝟐 𝟒 𝟒
𝟏
𝑨𝟐 (𝒙) = (−𝟑𝒙𝟓 − 𝟐𝒙𝟒 + 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )
𝟒
𝒙𝟐 (𝒙 − 𝟏)𝟐 𝟏 𝟓
𝑩𝟎 (𝒙) = (𝒙 + 𝟏) = (𝒙 − 𝒙𝟒 − 𝒙𝟑 + 𝒙𝟐 )
𝟒 𝟒
𝒙𝟐 (𝒙 + 𝟏)𝟐 𝟏 𝟓
𝑩𝟐 (𝒙) = (𝒙 − 𝟏) = (𝒙 + 𝒙𝟒 − 𝒙𝟑 − 𝒙𝟐 )
𝟒 𝟒
𝟏
𝒚 = 𝒇(𝒙) = 𝑷(𝒙) = (𝟑𝒙𝟓 − 𝟐𝒙𝟒 − 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )(𝟏) + (𝟏 − 𝟐𝒙𝟐 + 𝒙𝟒 )(𝟏)
𝟒
𝟏 𝟏
+ (−𝟑𝒙𝟓 − 𝟐𝒙𝟒 + 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )(𝟑) + (𝒙𝟓 − 𝒙𝟒 − 𝒙𝟑 + 𝒙𝟐 )(−𝟓)
𝟒 𝟒
𝟏
+( 𝒙𝟓 − 𝟐𝒙𝟑 + 𝒙)(𝟏) + (𝒙𝟓 + 𝒙𝟒 − 𝒙𝟑 − 𝒙𝟐 )(𝟕)
𝟒
Hence
𝟏 𝟒 𝟏 𝟐 𝟏 𝟏𝟏
𝒚(𝟎. 𝟓) = 𝒇(𝟎. 𝟓) ≅ 𝑷(𝟎. 𝟓) = 𝟐 ( ) − ( ) + + 𝟏 =
𝟐 𝟐 𝟐 𝟖
𝟏 𝟒 𝟏 𝟐 𝟏 𝟑
𝒚(−𝟎. 𝟓) = 𝒇(−𝟎. 𝟓) ≅ 𝑷(−𝟎. 𝟓) = 𝟐 (− ) − (− ) − + 𝟏 =
𝟐 𝟐 𝟐 𝟖
Example # 5:-
From the following data find 𝑷𝟓 (𝒙) using Hermite’s interpolation formula and hence
determine 𝒚(𝟎. 𝟓) = 𝑷𝟓 (𝟎. 𝟓).
𝒙 𝒚 = 𝒇(𝒙) 𝒚′ = 𝒇′(𝒙)
−𝟏 𝒙𝟎 𝟏 𝒚𝟎 −𝟏 𝒚′𝟎
𝟎 𝒙𝟏 𝟎 𝒚𝟏 𝟏 𝒚′𝟏
𝟏 𝒙𝟐 𝟏 𝒚𝟐 𝟎 𝒚′𝟐
Solution:-
The Hermite’s interpolation polynomial formula of degree at most 5 is given by (here
𝒏 = 𝟐)
𝟐 𝟐
we have:
𝒚(𝒙) = 𝒇(𝒙) ≅ 𝑷𝟓 (𝒙) = 𝑨𝟎 (𝒙)𝒚𝟎 + 𝑨𝟏 (𝒙)𝒚𝟏 + 𝑨𝟐 (𝒙)𝒚𝟐 + 𝑩𝟎 (𝒙)𝒚′ 𝟎 + 𝑩𝟏 (𝒙)𝒚′ 𝟏
+𝑩𝟐 (𝒙)𝒚′𝟐 (1)
Since the values of 𝒙 given are same as in the (Example#1) there is no change in
𝑨𝟎 , 𝑨𝟏 , 𝑨𝟐 , 𝑩𝟎 , 𝑩𝟏 and 𝑩𝟐 . Hence
𝟏
𝒚 = 𝒇(𝒙) = 𝑷𝟓 (𝒙) = (𝟑𝒙𝟓 − 𝟐𝒙𝟒 − 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )(𝟏) + (𝟏 − 𝟐𝒙𝟐 + 𝒙𝟒 )(𝟎)
𝟒
𝟏 𝟏
+ (−𝟑𝒙𝟓 − 𝟐𝒙𝟒 + 𝟓𝒙𝟑 + 𝟒𝒙𝟐 )(𝟏) + (𝒙𝟓 − 𝒙𝟒 − 𝒙𝟑 + 𝒙𝟐 )(−𝟏)
𝟒 𝟒
𝟏
+( 𝒙𝟓 − 𝟐𝒙𝟑 + 𝒙)(𝟏) + (𝒙𝟓 + 𝒙𝟒 − 𝒙𝟑 − 𝒙𝟐 )(𝟎)
𝟒
𝟏
𝒚(𝒙) = 𝒇(𝒙) ≅ 𝑷𝟓 (𝒙) = (𝟑𝒙𝟓 − 𝟑𝒙𝟒 − 𝟕𝒙𝟑 + 𝟕𝒙𝟐 + 𝟒𝒙)
𝟒
Therefore
𝟏
𝒚(𝟎. 𝟓) = 𝒇(𝟎. 𝟓) ≅ 𝑷𝟓 (𝟎. 𝟓) = [𝟑(𝟎. 𝟓)𝟓 − 𝟑(𝟎. 𝟓)𝟒 − 𝟕(𝟎. 𝟓)𝟑 + 𝟕(𝟎. 𝟓)𝟐 + 𝟒(𝟎. 𝟓)]
𝟒
𝒙 𝟎 𝟏
𝒚 = 𝒇(𝒙) 𝟎 𝟏
𝒚′ = 𝒇′(𝒙) 𝟎 𝟏
Answer:-
𝟑
𝒚 = 𝒚(𝒙) = 𝒇(𝒙) = 𝟐𝒙𝟐 − 𝒙𝟑 , 𝒇(𝟎. 𝟓) =
𝟖
𝒙 0 1
𝒚 = 𝒇(𝒙) 1 1
𝒚′ = 𝒇′(𝒙) 0 1
Answer:-
𝟕
𝒇(𝟎. 𝟓) =
𝟖
𝑷(𝒙) = (𝟏 + 𝜟)𝒑 𝒚𝟎 ⸪𝑬 = 𝟏 + 𝜟
𝒙−𝒙𝟎
where 𝒑=
𝒉
𝒙−𝒙𝒏
where 𝒑 =
𝒉
This is called Newton’s or Newton’s-Gregory backward interpolation formula.
1 𝒚𝟎 𝒚𝒏
2 𝜟 𝛁
3 +− ++
Important note:-
a): Newton’s forward interpolation formula is used for interpolating the values of the
function near the beginning/initial/start of the table.
b): Newton’s backward interpolation formula is used for interpolating the values of the
function near the end/final of the table.
Example # 6:-
Estimate 𝒚(𝟑. 𝟏𝟕) from the following data using Newton’s forward interpolation formula:
Solution:-
“Forward Difference Table”
𝒙 𝒚 𝚫𝐲 𝚫2y 𝚫3y 𝚫4y
3.1 0
0.6
3.2 0.6 -0.2
0.4 0
3.3 1.0 -0.2 0.1
0.2 0.1
3.4 1.2 -0.1
0.1
3.5 1.3
𝟎. 𝟕(𝟎. 𝟕 − 𝟏)
⇒ 𝑷(𝟑. 𝟏𝟕) = 𝟎 + (𝟎. 𝟕)(𝟎. 𝟔) + (−𝟎. 𝟐)
𝟐
𝟎.𝟕(𝟎.𝟕−𝟏)(𝟎.𝟕−𝟐) 𝟎.𝟕(𝟎.𝟕−𝟏)(𝟎.𝟕−𝟐)(𝟎.𝟕−𝟑)
+ (𝟎) + (𝟎. 𝟏)
𝟔 𝟐𝟒
Thus
Example # 7:-
Find the Newton’s forward interpolation polynomial for the data:
𝒙 -1 0 1 2
𝒚(𝒙) = 𝒇(𝒙) 4 2 2 4
𝒙 − 𝒙𝟎 𝒙 + 𝟏
𝒑= = =𝒙+𝟏
𝒉 𝟏
⇒ 𝒚 = 𝒇(𝒙) ≅ 𝑷(𝒙) = 𝒙𝟐 − 𝒙 + 𝟐
Hence
𝒚 = 𝒇(𝒙) ≅ 𝑷(𝒙) = 𝒙𝟐 − 𝒙 + 𝟐
Example # 8:-
Estimate 𝒚(𝟒𝟐) from the following data using Newton’s backward interpolation formula
𝒙 20 25 30 35 40 45
𝒚(𝒙) = 𝒇(𝒙) 354 332 291 260 231 204
Solution:-
“Backward Difference Table”
𝒙 𝒚 𝛁𝒚 𝛁𝟐 𝒚 𝛁𝟑 𝒚 𝛁𝟒 𝒚 𝛁𝟓 𝒚
𝟐𝟎 𝟑𝟓𝟒
𝟐𝟓 𝟑𝟑𝟐 −𝟐𝟐
−𝟏𝟗
𝟐𝟗
−𝟒𝟏
𝟑𝟎 𝟐𝟗𝟏 𝟏𝟎 −𝟑𝟕
𝟒𝟓
−𝟖
𝟑𝟓 𝟐𝟔𝟎 −𝟑𝟏 𝟐 𝟖
−𝟐𝟗 𝟎
𝟒𝟎 𝟐𝟑𝟏 𝟐
−𝟐𝟕
𝟒𝟓 204
𝒙 − 𝒙𝒏 𝟒𝟐 − 𝟒𝟓 −𝟑
⟹𝒑= = = = −𝟎. 𝟔
𝒉 𝟓 𝟓
As the point 𝒙 = 𝟒𝟐 is near the end of the table. We use Newton’s backward interpolation
formula
Example # 9:-
Given the following table
𝒙 1 2 3 4 5 6 7 8
Solution:-
𝒙 𝒚 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚 ∆𝟒 𝒚 ∆𝟓 𝒚 ∆𝟔 𝒚 ∆𝟕 𝒚
𝟏 𝟏
𝟕
𝟐 𝟖
𝟏𝟐
𝟏𝟗
𝟔
𝟑 𝟐𝟕 𝟏𝟖 𝟎
𝟎
𝟑𝟕 𝟔
𝟐𝟒 𝟎
𝟎
𝟒 𝟔𝟒 𝟎 𝟎
𝟔𝟏 𝟔
𝟑𝟎 𝟎
𝟎
𝟎
𝟓 𝟏𝟐𝟓 𝟔
𝟗𝟏
𝟑𝟔 𝟎
𝟔 𝟐𝟏𝟔
𝟏𝟐𝟕 𝟔
𝟒𝟐
7 𝟑𝟒𝟑
𝟏𝟔𝟗
8 𝟓𝟏𝟐
𝒙 − 𝒙𝟎 𝟏. 𝟓 − 𝟏
⟹𝒑= = = 𝟎. 𝟓
𝒉 𝟏
𝒙 − 𝒙𝒏 𝟕. 𝟓 − 𝟖
⟹𝒑= = = −𝟎. 𝟓
𝒉 𝟏
Answer:-
𝒇(𝟏. 𝟏) = 𝟑. 𝟒𝟏, 𝒇(𝟒. 𝟓) = 𝟐𝟗. 𝟐𝟓
Answer:-
𝒇(𝟎. 𝟓) = 𝟐. 𝟑𝟕𝟓, 𝒇(𝟔. 𝟕) = 𝟒𝟓𝟓. 𝟓𝟑𝟑
𝒇(𝒙𝟏 ) − 𝒇(𝒙𝟎 )
𝒇[ 𝒙 𝟎 , 𝒙 𝟏 ] =
𝒙𝟏 − 𝒙 𝟎
𝒇(𝒙𝟐 ) − 𝒇(𝒙𝟏 )
𝒇[ 𝒙 𝟏 , 𝒙 𝟐 ] =
𝒙𝟐 − 𝒙 𝟏
. . .
. . .
. . .
𝒇(𝒙𝒏 ) − 𝒇(𝒙𝒏−𝟏 )
𝒇[𝒙𝒏−𝟏 , 𝒙𝒏 ] =
𝒙𝒏 − 𝒙𝒏−𝟏
These are called first divided differences and is devoted by 𝚫𝒇. Higher divided differences
operators are defined as:
𝒇[ 𝒙 𝟏 , 𝒙 𝟐 ] − 𝒇[ 𝒙 𝟎 , 𝒙 𝟏 ]
𝒇[ 𝒙 𝟎 , 𝒙 𝟏 , 𝒙 𝟐 ] =
𝒙𝟐 − 𝒙𝟎
𝒇[ 𝒙 𝟐 , 𝒙 𝟑 ] − 𝒇[ 𝒙 𝟏 , 𝒙 𝟐 ]
𝒇[ 𝒙 𝟏 , 𝒙 𝟐 , 𝒙 𝟑 ] =
𝒙𝟑 − 𝒙𝟏
𝒇[ 𝒙 𝟏 , 𝒙 𝟐 , 𝒙 𝟑 ] − 𝒇[ 𝒙 𝟎 , 𝒙 𝟏 , 𝒙 𝟐 ]
𝒇[ 𝒙 𝟎 , 𝒙 𝟏 , 𝒙 𝟐 , 𝒙 𝟑 ] =
𝒙𝟑 − 𝒙𝟎
. . . . .
. . . . .
. . . . .
𝒙 𝒇 ∆𝒇 ∆𝟐 𝒇 ∆𝟑 𝒇
𝒙𝟎 𝒇( 𝒙 𝟎 )
𝒇(𝒙𝟏 )−𝒇(𝒙𝟎 )
𝒇[𝒙𝟎 , 𝒙𝟏 ] =
𝒙𝟏 −𝒙𝟎
𝒇(𝒙𝟑 )−𝒇(𝒙𝟐 )
𝒇[𝒙𝟐 , 𝒙𝟑 ] =
𝒙𝟑 −𝒙𝟐
𝒙𝟑 𝒇( 𝒙 𝟑 )
Example # 10:-
Make divided difference table for the data:
𝒙 -1 0 1 3
𝒚(𝒙) = 𝒇(𝒙) 2 1 0 -1
Solution:-
“Divided Difference Table”
𝒙 𝒇 𝚫𝐟 ∆𝟐 𝒇 ∆𝟑 𝒇
−𝟏𝒙𝟎 𝟐𝒇(𝒙𝟎)
𝟏−𝟐
= −𝟏𝒇[𝒙𝟎,𝒙𝟏]
𝟎−(−𝟏)
−𝟏−(−𝟏)
𝟎𝒙𝟏 𝟏𝒇(𝒙𝟏) = 𝟎𝒇[𝒙𝟎,𝒙𝟏 ,𝒙𝟐]
𝟏−(−𝟏)
𝟏
𝟎−𝟏 𝟔
−𝟎 𝟏
= −𝟏𝒇[𝒙𝟏,𝒙𝟐] =
𝟏−𝟎 𝟑−(−𝟏) 𝟐𝟒𝒇[𝒙 ,𝒙 ,𝒙 ,𝒙 ]
𝟎 𝟏 𝟐 𝟑
𝟏
−𝟐−(−𝟏) 𝟏
𝟏𝒙𝟐 𝟎𝒇(𝒙𝟐) =
𝟑−𝟎 𝟔𝒇[𝒙𝟏 ,𝒙𝟐 ,𝒙𝟑 ]
−𝟏−𝟎 𝟏
=−
𝟑−𝟏 𝟐𝒇[𝒙𝟐 ,𝒙𝟑 ]
𝟑𝒙𝟑 −𝟏𝒇(𝒙𝟑)
Example # 11:-
For the data:
𝒙 -1 0 2 5
𝒚(𝒙) = 𝒇(𝒙) 7 10 22 235
𝒙 𝒇 𝜟𝒇 ∆𝟐 𝒇 ∆𝟑 𝒇
-1 7
3
0 10 1
6 2
2 22 13
71
5 235
Hence
Example # 12:-
Using Newton’s divided difference formula find the value of 𝒚(𝟐), 𝒚(𝟖) and 𝒚(𝟏𝟓) given the
following table:
𝒙 4 5 7 10 11 13
𝒚(𝒙) = 𝒇(𝒙) 48 100 294 900 1210 2028
𝒙 𝒇 ∆𝒇 ∆𝟐 𝒇 ∆𝟑 𝒇 ∆𝟒 𝒇 ∆𝟓 𝒇
4 48
52
5 100 15
97 1
7 294 21 0
202 1 0
10 900 27 0
310 1
11 1210 33
409
13 2028
Solution:-
“Divided difference table”
Then
𝒚(𝟐) ≅ 𝑷(𝟐) = 𝟒𝟖 − 𝟏𝟎𝟒 + 𝟗𝟎 − 𝟑𝟎 = 𝟒
𝒙 0 1 3 4
𝒚(𝒙) = 𝒇(𝒙) 1 4 40 85
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≅ 𝑷(𝒙) = 𝒙𝟑 + 𝒙𝟐 + 𝒙 + 𝟏
𝒙 3 6 7 8 9 10
Answer:-
𝒇(𝟔) = 𝟏𝟒𝟕 , 𝒇(𝟖) = 𝟗𝟑
𝑭 (𝒈 𝒎𝒊𝒏−𝟏 ) 3 5 6 9
(i): Derive a polynomial passing through these data points using Newton’s Divided
interpolation method
(ii): Write Polynomial in simplest form.
(iii): Use this Polynomial to estimate 𝑷 at 𝟕 (𝒈 𝒎𝒊𝒏−𝟏 ) flow rate.
(iv): Interpret and conclude your results.
Answer:-
𝑷(𝑭) = 𝒇 (𝑭) ≈ 𝑷 (𝑭) =
S.N. Linear, First Degree Parabolic, Second Cubic Equation, 3rd Degree
Equation Degree, Quadratic Equation
Equation
Our aim is to find the value of 𝒚 corresponding to 𝒙, where 𝒙𝒊−𝟏 < 𝒙 < 𝒙𝒊 , 𝒊 = 𝟎, 𝟏, 𝟐, … . . 𝒏,
by using a smooth polynomial curve. We have already seen many methods. A recent one
which is becoming important is the spline-fitting.
4): 𝑺(𝒙𝒊 ) = 𝒚𝒊 , 𝒊 = 𝟎, 𝟏, 𝟐, … . , 𝒏
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏 (1)
𝟔
𝟔
𝑴𝒊−𝟏 + 𝟒𝑴𝒊 + 𝑴𝒊+𝟏 = 𝒉𝟐 [𝒚𝒊−𝟏 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏 ], 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏 − 𝟏 (2)
and
𝑴𝟎 = 𝑴𝒏 = 𝟎 (3)
9 𝒊 = 𝟏, 𝟐, 𝟑, 𝟒, 𝟓, 𝟔, 𝟕, 𝟖 𝑴 𝟎 = 𝑴𝟖 = 𝟎 𝒊 = 𝟏, 𝟐, 𝟑, 𝟒, 𝟓, 𝟔, 𝟕
𝑴𝟏 , 𝑴𝟐 , 𝑴𝟑 , 𝑴𝟒 , 𝑴𝟓 , 𝑴𝟔 , 𝑴𝟕
7 𝒊 = 𝟏, 𝟐, 𝟑, 𝟒, 𝟓, 𝟔 𝑴 𝟎 = 𝑴𝟔 = 𝟎 𝒊 = 𝟏, 𝟐, 𝟑, 𝟒, 𝟓
𝑴𝟏 , 𝑴𝟐 , 𝑴𝟑 , 𝑴𝟒 , 𝑴𝟓
5 𝒊 = 𝟏, 𝟐, 𝟑, 𝟒 𝑴 𝟎 = 𝑴𝟒 = 𝟎 𝒊 = 𝟏, 𝟐, 𝟑
𝑴𝟏 , 𝑴𝟐 , 𝑴𝟑
3 𝒊 = 𝟏, 𝟐 𝑴 𝟎 = 𝑴𝟐 = 𝟎 𝒊=𝟏
𝑴𝟏
Example # 13:-
From the following table:
𝒙 1 2 3
𝒙𝟎 𝒙𝟏 𝒙𝟐
𝒚(𝒙) -8 -1 18
𝒚𝟎 𝒚𝟏 𝒚𝟐
For 𝒊 = 𝟏, we get:-
𝟔
⟹ 𝑴𝟎 + 𝟒𝑴𝟏 + 𝑴𝟐 = [𝒚 − 𝟐𝒚𝟏 + 𝒚𝟐 ]
𝟏𝟐 𝟎
⟹ 𝑴𝟏 = 𝟏𝟖
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐 (1)
𝟔
𝟏 𝟏 𝟏 𝟏
𝑺(𝒙) = [𝟎 + (𝟐 − 𝒙)(−𝟖 − 𝟎) + (𝒙 − 𝟏)[−𝟏 − (𝟏𝟖)]
𝟔 𝟏 𝟏 𝟔
𝟏
𝑺(𝒙) = [𝟏𝟖(𝒙 − 𝟏)𝟑 ] + (𝟐 − 𝒙)(−𝟖) + (𝒙 − 𝟏)(−𝟒)
𝟔𝒉
Hence
−𝟒𝟓
𝒚(𝟏. 𝟓) ≅ 𝑺(𝟏. 𝟓) = 𝟑(𝟏. 𝟓)𝟑 − 𝟗(𝟏. 𝟓)𝟐 + 𝟏𝟑(𝟏. 𝟓) − 𝟏𝟓 =
𝟖
𝟒𝟓
𝒚(𝟏. 𝟓) = −
𝟖
and
Therefore
Note:-
We can also find 𝑺(𝒙) in the interval (𝟐, 𝟑)using equation (1) for 𝒊 = 𝟐. Since 𝒚(𝟏. 𝟓) is
required, we have not cared to find 𝑺(𝒙) in (𝟐, 𝟑).
Example # 14:-
Using Cubic Spline, find 𝒚(𝟎. 𝟓) and 𝒚′(𝟏) given that 𝑴𝟎 = 𝑴𝟐 = 𝟎 and the table:
𝒙 0 1 2
𝒙𝟎 𝒙𝟏 𝒙𝟐
𝒚(𝒙) -5 -4 3
𝒚𝟎 𝒚𝟏 𝒚𝟐
Solution:-
Here 𝒉 = 𝟏 and 𝒏 = 𝟐 and 𝑴𝟎 = 𝑴𝟐 = 𝟎. We have
𝟔
𝑴𝒊−𝟏 + 𝟒𝑴𝒊 + 𝑴𝒊+𝟏 = [𝒚 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏 ], 𝒊=𝟏
𝒉𝟐 𝒊−𝟏
For 𝒊 = 𝟏, we get:-
𝟔
𝑴𝟎 + 𝟒𝑴𝟏 + 𝑴𝟐 = [𝒚 − 𝟐𝒚𝟏 + 𝒚𝟐 ]
𝟏𝟐 𝟎
⟹ 𝟒𝑴𝟏 = 𝟑𝟔
⟹ 𝑴𝟏 = 𝟗
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐 (1)
𝟔
𝟏 𝟗
⟹ 𝑺(𝒙) = [𝟎 + (𝒙 − 𝟎)𝟑 (𝟗)] + (𝟏 − 𝒙)(−𝟓 − 𝟎) + (𝒙 − 𝟎) (−𝟒 − )
𝟔 𝟔
𝟑 𝟑𝟑
⟹ 𝑺(𝒙) = (𝒙)𝟑 − 𝟓(𝟏 − 𝒙) − 𝒙
𝟐 𝟔
𝟑 𝒙
⟹ 𝑺(𝒙) = (𝒙)𝟑 − − 𝟓 , For 𝟎 ≤ 𝒙 ≤ 𝟏
𝟐 𝟐
𝟑 𝟏 𝟑 𝟏 𝟏 𝟖𝟏
⟹ 𝒚(𝟎. 𝟓) ≅ 𝑺(𝟎. 𝟓) = ( ) − ( ) ( ) − 𝟓 = −
𝟐 𝟐 𝟐 𝟐 𝟏𝟔
and
𝟗 𝟏
𝒚′ (𝒙) ≅ 𝑺′ (𝒙) = (𝒙)𝟐 − ( )
𝟐 𝟐
Therefore
𝟗 𝟏
𝒚′(𝟏) ≅ 𝑺′(𝟏) = (𝟏)𝟐 − ( ) = 𝟒
𝟐 𝟐
Example # 15:-
Find the Cubic Spline Interpolation Polynomial for the data given below under the conditions
𝑴(𝟎) = 𝑴(𝟑) = 𝟎 and valid in the sub-interval [𝟏, 𝟐]. Hence find 𝒇(𝟏. 𝟓):
𝒙 𝟎 𝟏 𝟐 𝟑
𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒙𝟑
𝒚 = 𝒇(𝒙) 𝟏 𝟒 𝟏𝟎 𝟖
𝒚𝟎 𝒚𝟏 𝒚𝟐 𝒚𝟑
Answer:-
Here 𝒉 = 𝟏, 𝒏 = 𝟑 and 𝑴𝟎 = 𝑴𝟑 = 𝟎. We have
𝟔
𝑴𝒊−𝟏 + 𝟒𝑴𝒊 + 𝑴𝒊+𝟏 = [𝒚𝒊−𝟏 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏 ] , 𝒊 = 𝟏, 𝟐
𝒉𝟐
𝟔
𝑴𝒐 + 𝟒𝑴𝟏 + 𝑴𝟐 = [𝒚𝟎 − 𝟐𝒚𝟏 + 𝒚𝟐 ]
𝒉𝟐
𝟔
𝑴𝟏 + 𝟒𝑴𝟐 + 𝑴𝟑 = [𝒚𝟏 − 𝟐𝒚𝟐 + 𝒚𝟑 ]
𝒉𝟐
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐,3 (1)
𝟔
𝟏 𝟑 𝟑 𝟏 𝒉𝟐
𝑺(𝒙) = 𝟔𝒉 [(𝒙𝟐 − 𝒙) 𝑴𝟏 + (𝒙 − 𝒙𝟏 ) 𝑴𝟐 ] + 𝒉 (𝒙𝟐 − 𝒙) [𝒚𝟏 − 𝑴𝟏 ]
𝟔
𝟏 𝒉𝟐
+ (𝒙 − 𝒙𝟐 ) [𝒚𝟐 − 𝑴 ]
𝒉 𝟔 𝟐
Dr. Jamil Book Series 2 Page 32
Applied Numerical Methods Chapter#2 Interpolation & Curve Fitting
𝟏 𝟏 𝟏 𝟏 𝟏𝟒
𝑺(𝒙) = [(𝟐 − 𝒙)𝟑 . 𝟖 + (𝒙 − 𝟏)𝟑 (−𝟏𝟒)] + (𝟐 − 𝒙) [𝟒 − 𝟖] + (𝒙 − 𝟐) [𝟏𝟎 + ]
𝟔 𝟏 𝟔 𝟏 𝟔
𝟏
𝒚(𝒙) = 𝒇(𝒙) = 𝑺(𝒙) = (−𝟏𝟏𝒙𝟑 + 𝟒𝟓𝒙𝟐 − 𝟒𝟎𝒙 + 𝟏𝟖), 𝐅𝐨𝐫 𝟏 ≤ 𝒙 ≤ 𝟐 → (𝟐)
𝟑
𝟏
𝒚(𝟏. 𝟓) = 𝑺(𝟏. 𝟓) = {−𝟏𝟏(𝟏. 𝟓)𝟑 + 𝟒𝟓(𝟏. 𝟓)𝟐 − 𝟒𝟎(𝟏. 𝟓) + 𝟏𝟖} = 𝟕. 𝟑𝟕𝟓
𝟑
Example # 16:-
Find the Cubic Spline Polynomial in each interval for the function given below:
𝒙 0 1 2 3
𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒙𝟑
𝒚 = 𝒇(𝒙) 1 2 33 244
𝒚𝟎 𝒚𝟏 𝒚𝟐 𝒚𝟑
𝟔
𝑴𝒊−𝟏 + 𝟒𝑴𝒊 + 𝑴𝒊+𝟏 = [𝒚𝒊−𝟏 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏 ] , 𝒊 = 𝟏, 𝟐
𝒉𝟐
𝟔
𝑴𝟏 + 𝟒𝑴𝟐 + 𝑴𝟑 = [𝒚𝟏 − 𝟐𝒚𝟐 + 𝒚𝟑 ]
𝒉𝟐
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐, 𝟑 (1)
𝟔
We get
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝟏 − 𝒙) 𝑴𝟎 + (𝒙 − 𝒙𝟎 ) 𝑴𝟏 ] + (𝒙𝟏 − 𝒙) [𝒚𝟎 − 𝑴𝟎 ]
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ (𝒙 − 𝒙𝟎 ) [𝒚𝟏 − 𝑴𝟏 ]
𝒉 𝟔
𝟏 𝟏 (−𝟐𝟒)
⇒ 𝑺(𝒙) = [(𝟏 − 𝒙)𝟑 (𝟎) + (𝒙 − 𝟎)𝟑 (−𝟐𝟒) + (𝟏 − 𝒙) [𝟏 − (𝟎)] + (𝒙 − 𝟎)[𝟐 − ]
𝟔 𝟔 𝟔
⇒ 𝑺(𝒙) = −𝟒𝒙𝟑 + (𝟏 − 𝒙) + 𝟔𝒙
𝟏 𝒉𝟐
+ (𝒙 − 𝒙𝟐 ) [𝒚𝟐 − 𝑴 ]
𝒉 𝟔 𝟐
Substituting values, we have
𝟏 𝟑 𝟑 𝟑 𝟏 𝒉𝟐
𝑺(𝒙) = 𝟔𝒉 [(𝒙 − 𝒙) 𝑴𝟐 + (𝒙 − 𝒙𝟐 ) 𝑴𝟑 ] + 𝒉 (𝒙𝟑 − 𝒙) [𝒚𝟐 − 𝑴𝟐 ]
𝟔
𝟏 𝒉𝟐
+ (𝒙 − 𝒙𝟐 ) [𝒚𝟑 − 𝑴 ]
𝒉 𝟔 𝟑
𝟏 𝟏 𝟏
⇒ 𝑺(𝒙) = [(𝟑 − 𝒙)𝟑 (𝟐𝟕𝟔) + (𝒙 − 𝟐)𝟑 (𝟎)] +(𝟑 − 𝒙) [𝟑𝟑 − (𝟐𝟕𝟔)] + (𝒙 − 𝟐)[𝟐𝟒𝟒 − (𝟎)]
𝟔 𝟔 𝟔
Equations (2), (3) and (4) give the cubic Spline Polynomial in each sub-interval.
For 𝒚(𝟐. 𝟓) we use eq (4), therefore
Answer:-
𝟏
𝑴𝟏 = 𝟑 , 𝑰𝒏 [𝟎, 𝟏] , 𝑺(𝒙) = (𝟑𝒙 + 𝒙𝟑 )
𝟐
𝟏𝟑
𝒚(𝟎. 𝟓) = , 𝒚′ (𝟏) = 𝟑
𝟏𝟔
𝒚 = 𝒇(𝒙) 𝟎 𝟏 𝟎
𝒙 0 2 4 6
𝒚(𝒙) 1 9 41 41
At the end put down your conclusions and express suitable interpretation either
physical/geometrical/technical or Mechanical on your method or results. What is your
understanding! Is 𝒇(𝟑) determination form Cubic Spline procedure in your thinking is the best
? Why ?
𝒙 𝟎 𝒙𝟎 𝟏 𝒙𝟏 𝟑 𝒙𝟐 4 𝒙𝟑
𝒚 = 𝒇(𝒙) −𝟏𝟐 𝒚𝟎 𝟎 𝒚𝟏 𝟏𝟐 𝒚𝟐 12 𝒚𝟑
Use any two different method to find the polynomial passing through the data and prove
that the Polynomial is unique form any two different methods.
Solution:-
1): From Lagrange’s Interplation Plynomial Method:-
Now
(𝒙 − 𝒙𝟏 )(𝒙 − 𝒙𝟐 )(𝒙 − 𝒙𝟑 ) (𝒙 − 𝟏)(𝒙 − 𝟑)(𝒙 − 𝟒)
𝑳𝟎 (𝒙) = =
(𝒙𝟎 − 𝒙𝟏 )(𝒙𝟎 − 𝒙𝟐 )(𝒙𝟎 − 𝒙𝟑 ) (𝟎 − 𝟏)(𝟎 − 𝟑)(𝟎 − 𝟒)
−𝟏 𝟑
𝑳𝟎 (𝒙) = (𝒙 − 𝟖𝒙𝟐 + 𝟏𝟗𝒙 − 𝟏𝟐)
𝟏𝟐
𝟏 𝟑 𝟏
𝒚 = 𝒇(𝒙) = 𝑷(𝒙) = − (𝒙 − 𝟖𝒙𝟐 + 𝟏𝟗𝒙 − 𝟐)(−𝟏𝟐) + 𝟎 − (𝒙𝟑 − 𝟓𝒙𝟐 + 𝟒𝒙)(𝟏𝟐)
𝟏𝟐 𝟔
𝟏 𝟑
+ (𝒙 − 𝟒𝒙𝟐 + 𝟑𝒙)(𝟐𝟒)
𝟏𝟐
𝒙 𝒇 𝜟𝒇 ∆𝟐 𝒇 ∆𝟑 𝒇
0 -12
12
1 0 -2
6 1
3 12 2
12
4 24
Conculusion:-
From Eqs.(2) and (3), it is clear that from two different methods the interpolation polynomial
passes through same data is same that is Unique. This prove the first segment of the theorem
that Polynomial is Unique.
𝑻𝒊𝒎𝒆 𝒕 (𝑫𝒂𝒚𝒔) 1 3 4 6
(i): Estimate the polynomial 𝑸 (𝒕) using best interpolation method (why) that you think.
(ii): Write Polynomial 𝑸 (𝒕) in simplest form.
(iii): Use this Polynomial to estimate 𝑸 at 𝟓 (𝑫𝒂𝒚𝒔) time.
(iv): Interpret, conclude and compose final remarks on your method & results.
Distance: 𝒙 0 2 3 6 9 10
CHAPTER # 2
PART-II: CURVE FITTING
Least Squares Method For Curve Fitting Method
Introduction:-
Let 𝒚, 𝒚𝒊 = 𝑬𝒙𝒂𝒄𝒕 𝒗𝒂𝒍𝒖𝒆
̅ = 𝒇(𝒙), 𝒚
𝒚 ̅𝒊 = 𝒇(𝒙𝒊 ) = 𝑨𝒑𝒑𝒓𝒐𝒙𝒊𝒎𝒂𝒕𝒆 𝒗𝒂𝒍𝒖𝒆
Least square approximation is the most commonly used method for finding an approximate
curve for the given data dealing with science and engineering. This method was developed
by Legendre. Suppose we have given the following data:
“Table of values”
𝒙 𝒙𝟏 𝒙𝟐 … 𝒙𝒊 … 𝒙𝒏
𝒚(𝒙) = 𝒇(𝒙) 𝒚𝟏 𝒚𝟐 … 𝒚𝒊 … 𝒚𝒏
OR
(𝒙𝒊 , 𝒚𝒊 ), 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏
be the given data. Let 𝒚 = 𝒇(𝒙) be an approximation to the function 𝒚. The 𝒊𝒕𝒉 errors
between 𝒚′𝒔 of the data and 𝒚′𝒔 of the approximation are given by:
𝑬𝒊 = 𝒚𝒊 − 𝒚𝒊 = 𝒚𝒊 − 𝒇(𝒙𝒊 ), 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏
Since the error can be either +𝒗𝒆 or – 𝒗𝒆. We will consider 𝑬𝟐𝒊 .
𝟐
𝑬𝒊 𝟐 = (𝒚𝒊 − 𝒚𝒊 )𝟐 = (𝒚𝒊 − 𝒇(𝒙𝒊 )) , 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏
Let
“Table of values”
𝒙 𝒙𝟏 𝒙𝟐 … 𝒙𝒊 … 𝒙𝒏
𝒚(𝒙) = 𝒇(𝒙) 𝒚𝟏 𝒚𝟐 … 𝒚𝒊 … 𝒚𝒏
OR
(𝒙𝒊 , 𝒚𝒊 ), 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏
𝒚(𝒙) = 𝒇(𝒙) = 𝒂𝒙 + 𝒃
Now we have to select 𝒂 and 𝒃 so that the straight line is the best fit to the data. The error is
given by
𝑬𝒊 = 𝒚𝒊 − 𝒚𝒊 = 𝒚𝒊 − 𝒇(𝒙𝒊 ) = 𝒚𝒊 − (𝒂𝒙𝒊 + 𝒃), 𝒊 = 𝟏, 𝟐, … , 𝒏
𝒏 𝒏
The principle of least squares, 𝑬 minimum condition provides the following normal
equations.
Normal Equations for straight line:-
𝒏 𝒏
𝒂 ∑ 𝒙𝒊 + 𝒏𝒃 = ∑ 𝒚𝒊
𝒊=𝟏 𝒊=𝟏
𝒏 𝒏 𝒏
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
𝒊=𝟏 𝒊=𝟏 𝒊=𝟏
OR
𝒂 ∑ 𝒙𝒊 + 𝒏𝒃 = ∑ 𝒚𝒊
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
By solving these equations, we can determine 𝒂 and 𝒃 to obtain the best fitted straight
line 𝒚(𝒙) = 𝒇(𝒙) = 𝒂𝒙 + 𝒃 .
Example # 18:-
By the method of least squares find the best fitting straight line to the data given below:
𝒙 5 10 15 20 25
𝒚 = 𝒚(𝒙) 16 19 23 26 30
Solution:-
Let 𝒚 = 𝒂𝒙 + 𝒃 be the best fit straight line to the data. Then the normal equations are:
𝒂 ∑ 𝒙𝒊 + 𝒏𝒃 = ∑ 𝒚𝒊 (1)
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊 (2)
“Table of Values”
𝒙 𝒚 𝒙𝟐 𝒙𝒚
5 16 25 80
10 19 100 190
15 23 225 345
20 26 400 520
25 30 625 750
⇒ 𝒂 = 𝟎. 𝟕, 𝒃 = 𝟏𝟐. 𝟑
Hence the best fitting line is
𝒚 = 𝟎. 𝟕𝒙 + 𝟏𝟐. 𝟑
𝒙 1 2 3 4 5
𝒚(𝒙) 16 19 23 26 30
Answer:-
𝒚 = 𝟑. 𝟓𝒙 + 𝟏𝟐. 𝟑
𝒙 0 1 2 3 4
Answer:-
𝒚 = 𝟏. 𝟑𝟑𝒙 + 𝟎. 𝟕𝟐, 𝒚(𝟐. 𝟓) = 𝟒. 𝟎𝟒𝟓
𝒙 0 5 10 15 20
𝒚(𝒙) 7 11 16 20 26
Answer:-
𝒙 1 2 3 4 5
Hint:-
Put 𝒀 = 𝒚/𝒙 = 𝒂 + 𝒃𝒙 (straight line case)
Answer:-
𝒚(𝒙) = 𝟏. 𝟑𝟕𝟏𝟖𝒙 + 𝟎. 𝟓𝟐𝟗𝟓𝒙𝟐
𝒙 1 2 4 6 8
Hint:-
Put 𝒀 = 𝒙𝒚 , 𝑿 = 𝒙𝟐 (straight line case)
Answer:-
𝒙𝒚 = 𝟑. 𝟎𝟐𝟎𝟓 + 𝟐. 𝟑𝟗𝟏𝟖𝒙𝟐
𝒙 𝒙𝟏 𝒙𝟐 … 𝒙𝒊 … 𝒙𝒏
𝒚(𝒙) = 𝒇(𝒙) 𝒚𝟏 𝒚𝟐 … 𝒚𝒊 … 𝒚𝒏
OR
(𝒙𝒊 , 𝒚𝒊 ), 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏
be the given data. Suppose the approximate second degree curve be given by
Now we have to select 𝒂, 𝒃 and 𝒄 so that the second degree curve is the best fit to the data.
The 𝒊𝒕𝒉 error is given by
𝑬𝒊 = 𝒚𝒊 − 𝒚𝒊 = 𝒚𝒊 − 𝒇(𝒙𝒊 ) = 𝒚𝒊 − (𝒂𝒙𝟐𝒊 + 𝒃𝒙𝒊 + 𝒄), 𝒊 = 𝟏, 𝟐, … , 𝒏
𝟐
⟹ 𝑬𝟐𝒊 = [𝒚𝒊 − (𝒂𝒙𝟐𝒊 + 𝒃𝒙𝒊 + 𝒄)]
By the principle of least squares, 𝑬 minimum condition provides the following normal
equations:
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 + 𝒏𝒄 = ∑ 𝒚𝒊
𝒂 ∑ 𝒙𝟑𝒊 + 𝒃 ∑ 𝒙𝟐𝒊 + 𝒄 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
By solving these equations, we can determine 𝒂, 𝒃 and 𝒄 to obtain the best fit second degree
polynomial 𝒚(𝒙) = 𝒇(𝒙) = 𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 .
Example # 19:-
Fit a parabola, by the method of least squares, to the following data; also estimate 𝒚(𝟔) .
𝒙 1 2 3 4 5
𝒚(𝒙) 5 12 26 60 97
Solution:-
Let 𝒚 = 𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 be the best fit parabola. Then the normal equations are:
𝟑 𝟐
𝒂∑𝒙𝒊 𝟒 + 𝒃∑𝒙𝒊 + 𝒄∑𝒙𝒊 = ∑𝒙𝒊 𝟐 𝒚𝒊 (3)
“Tables of values”
𝒙 𝒚 𝒙𝟐 𝒙𝟑 𝒙𝟒 𝒙𝒚 𝒙𝟐 𝒚
1 5 1 1 1 5 5
2 12 4 8 16 24 48
3 26 9 27 81 78 234
and
𝒚(𝟔) = 𝟓. 𝟕𝟏𝟒𝟑(𝟔)𝟐 − 𝟏𝟏. 𝟎𝟖𝟓𝟖(𝟔) + 𝟏𝟎. 𝟒𝟎𝟎𝟏
𝒙 𝟏 𝟐 𝟑 𝟒 𝟓
𝒚 𝟐 𝟑 𝟓 𝟖 𝟏𝟎
Answer:-
𝒙 5 𝟏𝟎 𝟏𝟓 𝟐𝟎 𝟐𝟓
𝒚 𝟏𝟔 𝟏𝟗 𝟐𝟑 𝟐𝟔 𝟑𝟎
Answer:-
Important Note:-
The Normal Equations of the line 𝒚 = 𝒂𝒙 + 𝒃 (𝐇𝐞𝐫𝐞 𝐚 = 𝐒𝐥𝐨𝐩 𝐚𝐧𝐝 𝐛 = 𝐲 − 𝐢𝐧𝐭𝐞𝐫𝐜𝐞𝐩𝐭)
are :
𝒂 ∑ 𝒙𝒊 + 𝒏𝒃 = ∑ 𝒚𝒊
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
This being linear in 𝒙 and 𝒀 , we can find 𝑨, 𝑩 since 𝒙 and 𝒀 = 𝒍𝒐𝒈𝒚 are known. From 𝑨, 𝑩
we can get 𝒂, 𝒃 by antilog (𝒂 = 𝟏𝟎𝑨 , 𝒃 = 𝟏𝟎𝑩 ) and hence 𝒚 = 𝒂𝒃𝒙 is found out.
𝑩 ∑ 𝒙𝒊 + 𝒏𝑨 = ∑ 𝒀𝒊
𝑩 ∑ 𝒙𝟐𝒊 + 𝑨 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒀𝒊
Again using this linear fit, we find 𝑨, 𝒃. Hence 𝒂, 𝒃 (𝒂 = 𝟏𝟎𝑨 ) are known. Thus 𝒚 = 𝒂𝒙𝒃 is
found out.
Normal Equations of Polynomial curve:-
In 𝒀 = 𝑨 + 𝒃𝑿are, b is Slop representative and A is y-Intercept. Then Normal Equations of
the line 𝒀 = 𝑨 + 𝒃𝑿are :
𝒃 ∑ 𝑿𝒊 + 𝒏𝑨 = ∑ 𝒀𝒊
𝒃 ∑ 𝑿𝟐𝒊 + 𝑨 ∑ 𝑿𝒊 = ∑ 𝑿𝒊 𝒀𝒊
Example # 20:-
Fit a curve of the form 𝒚 = 𝒂𝒃𝒙 to the data
𝒙 𝟏 𝟐 𝟑 𝟒 𝟓 𝟔
Solution:-
Since 𝒚 = 𝒂𝒃𝒙 , Applying logarithm on both sides;
“Table of values”
𝒙 𝒚 𝒀 𝒙𝟐 𝒙𝒀
3 𝟔𝟏 1.7853 9 5.3559
4 𝟓𝟎 1.6990 16 6.7960
5 𝟐𝟎 1.3010 25 6.5050
6 𝟖 0.9031 36 5.4186
21 - 9.8674 91 30.2545
Since
Example # 21:-
Fit a curve of the 𝒚 = 𝒂𝒙𝒃 to the data
𝒙 𝟏 𝟐 𝟑 𝟒 𝟓 𝟔
Solution:-
Since 𝒚 = 𝒂𝒙𝒃 , Applying logarithm on both sides;
⟹ 𝒍𝒐𝒈𝒚 = 𝒍𝒐𝒈𝒂 + 𝒃𝒍𝒐𝒈𝒙
“Tables of values”
𝒙 𝒚 𝑿 𝒀 𝑿𝟐 𝑿𝒀
Since
⟹ 𝒚(𝒙) = 𝟐𝟎𝟑𝟓𝒙−𝟏.𝟕𝟒𝟗𝟒
Answer:-
𝒚(𝒙) = 𝟕. 𝟏𝟕𝟑𝒙𝟏.𝟗𝟓𝟐
Drill Excercise # 19:-
Fit a curve of the form 𝒚 = 𝒂𝒆𝒃𝒙 to the data by the method of least squares:
𝒙 𝟎 𝟓 𝟖 𝟏𝟐 𝟐𝟎
𝒚 𝟑. 𝟎 𝟏. 𝟓 𝟏. 𝟎 𝟎. 𝟓𝟓 𝟎. 𝟏𝟖
Answer:-
𝒚(𝒙) = 𝟑. 𝟎𝟑𝟎𝟒𝒆−𝟎.𝟏𝟒𝟏𝟏𝒙
Drill Excercise # 20:-
A glass of water containing approximately 𝒏𝟎 bacteria was exposed to UV radiation. The
number of bacteria remaining in the glass was recorded with time 𝒕. The number of
bacteria is known to vary with time following the model
𝒏 = 𝒏𝟎 𝒆𝜶𝒕
where 𝒏𝟎 is the number of bacteria at the start of the experiment and 𝜶 is the rate of
destruction.
𝑻𝒊𝒎𝒆 𝒕(𝒎𝒊𝒏) 5 10 15 20 25 30
(𝜶): Find 𝒏𝟎 and 𝜶 by the methods of Least Square Method and complete the above model.
(𝜷): Determine number of bacteria at time 𝒕 = 𝟐𝟕 𝒎𝒊𝒏. from this relation.
(𝜸): Use this Polynomial to estimate 𝑷 at 𝟕 (𝒈 𝒎𝒊𝒏−𝟏 ) flow rate.
(𝜹): Interpret and conclude your results.
𝒕 1 2 3 4 5
(i): Design a Mathematical Model of Polynomial Fit of the form 𝑹 = 𝜶𝒙𝜷 through Least
Square Method.
(ii): Try to roughly Draw/plot the graph of 𝑹 = 𝜶𝒙𝜷 (after finding 𝜶 and 𝜷). Is the curve is
Passes through the Origin. What is the best name you suggest this curve ?
(iii): Use this Polynomial to estimate Resistance 𝑹 at 𝒕 = 𝟔.
(iv): Interpret and conclude your results.
EXERCISE-2
Lagrange’s Interpolation Polynomial Method
Question # 1:-
Determine the Lagrange’s interpolation Polynomial for the data:
𝒙 𝟎 𝟏 𝟑
𝒚 = 𝒇(𝒙) 𝟏 𝟑 𝟓𝟓
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) = 𝟖𝒙𝟐 − 𝟔𝒙 + 𝟏 and 𝒇(𝟐) = 𝟐𝟏
Question # 2:-
Find the missing value from the following data using Lagrange interpolation Polynomial:
𝒙 𝟎 𝟏 𝟐 𝟑 𝟒
𝒚 = 𝒇(𝒙) −𝟏𝟐 𝟎 − 𝟔 𝟏𝟐
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) = 𝒙𝟑 − 𝟕𝒙𝟐 + 𝟏𝟖𝒙 − 𝟏𝟐 and 𝒇(𝟐) = 𝟒
Question # 3:-
Use Lagrange interpolation Polynomial, find (𝟏) :
𝒙 −𝟏 𝟎 𝟐 𝟑
𝒚 = 𝒇(𝒙) 𝟓 𝟐 𝟎 𝟏
Answer:-
𝟏
𝒇(𝟏) =
𝟑
Question # 4:-
The Chemical Oxygen Demand(COD) is found to increase downstream a river. The data
collected from the experiment are tabulated below:
𝑫𝒊𝒔𝒕𝒂𝒏𝒄𝒆 (𝑲𝒎) 𝒅 0 1 2 5
Answer:-
𝑪(𝒅) = 𝒇(𝒅) = 𝒅𝟑 + 𝒅𝟐 − 𝒅 + 𝟐
Question # 5:-
The following table gives corresponding values of Pressure of a steam at a given
temperature.
1): Make a Mathematical Model using Lagrange interpolation polynomial,
2): Write Polynomial in simplest form.
3): Find the pressure for a temperature of 𝟏𝟔𝟓° 𝑪
4): Interpret and conclude your results.
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) =
Question # 6:-
Use the following data :
𝒙 0 1 3 4
𝒚 = 𝒇(𝒙) 5 6 50 105
1): Make a Mathematical Model through Polynomial using Lagrange interpolation method,
2): Write Polynomial in simplest form.
3): Use this Polynomial to estimate 𝒇(𝟐. 𝟓).
4): Interpret and conclude your results.
Answer:-
Question # 7:-
Find Lagrange’s interpolation Polynomial fitting the Points (𝟏) = −𝟑 , 𝒚(𝟑) = 𝟎 , 𝒚(𝟒) =
𝟑𝟎 , 𝒚(𝟔) = 𝟏𝟑𝟐. Hence find 𝒇(𝟓).
Answer:-
𝟏
𝒚(𝒙) = 𝒇(𝒙) = (−𝒙𝟑 + 𝟐𝟕𝒙𝟐 − 𝟗𝟐𝒙 + 𝟔𝟎)
𝟐
𝒚(𝟓) = 𝒇(𝟓) = 𝟕𝟓
Question # 8:-
Given the following data, evaluate 𝒇(𝟑) using Lagrange’s interpolation Polynomial:
𝒙 𝟏 𝟐 𝟓
𝒚 = 𝒇(𝒙) 𝟏 𝟒 𝟏𝟎
Answer:-
𝒇(𝟑) = 𝟔. 𝟒𝟗𝟗𝟗
Question # 9:-
Determine by Lagrange’s method the percentage number of patients over 40 years, using
the following data:
Answer:-
𝒚(𝟒𝟎) = 𝒇(𝟒𝟎) = 𝟕𝟒. 𝟕
Question # 9:-
Obtain the Lagrange’s interpolation Polynomial of 𝒚(𝒙) from the following data; and
obtain 𝒚(𝟐. 𝟓):
𝒙 𝟎 𝟏 𝟑 𝟒
𝒚 = 𝒇(𝒙) 𝟓 𝟔 𝟓𝟎 𝟏𝟎𝟓
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) = 𝒙𝟑 + 𝟑𝒙𝟐 − 𝟑𝒙 + 𝟓
Question # 10:-
The following data give the percentage of criminals for different age groups:
% 𝒐𝒇 𝒄𝒓𝒊𝒎𝒊𝒏𝒂𝒍𝒔 𝟐𝟔 𝟑𝟒 𝟒𝟐 𝟒𝟕
Using Lagrange’s formula, estimate the percentage of criminals under the age of 35.
Answer:-
𝒇(𝟑𝟓) ≈ 𝑷(𝟑𝟓) = 𝟑𝟖. 𝟗𝟓
Question # 11:-
Use Lagrange’s interpolation formula to fit a Polynomial to the following data:
𝒙 𝟎 𝟏 𝟑 𝟒
𝒚 = 𝒇(𝒙) −𝟏𝟐 𝟎 𝟔 𝟏𝟐
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) = 𝒙𝟑 − 𝟕𝒙𝟐 + 𝟏𝟖𝒙 − 𝟏𝟐
Question # 12:-
The following table are the measurement 𝑻 made on a curve record by oscilograph
representing a change of current 𝑰 due to a change in the conditions of an electric current:
1): Construct a Mathematical Model by Lagrange interpolation polynomial,
2): Write Polynomial in uncomplicated form.
3): Find the current 𝑰 for a 𝑻 = 𝟑.
4): Interpret and conclude your results.
𝑻, 0 1 4 5
Current 𝑰 8 11 68 123
Answer:-
𝑰(𝑻) =≈ 𝑷(𝑻) = 𝑻𝟑 − 𝑻𝟐 + 𝟑𝑻 + 𝟖
𝒙 −𝟏 𝟎 𝟏
𝒚 = 𝒇(𝒙) 𝟏 𝟏 𝟑
𝒚′ = 𝒇’(𝒙) −𝟓 𝟏 𝟕
Answer:-
𝟏𝟏 𝟑
𝒇(𝒙) ≈ 𝑷(𝒙) = 𝟐𝒙𝟒 − 𝒙𝟐 + 𝒙 + 𝟏 and (−𝟎. 𝟓) = , 𝒇(𝟎. 𝟓) =
𝟖 𝟖
Question # 14:-
From the following data find 𝑷(𝒙) using hermit’s interpolation formula and find 𝒇(𝟎. 𝟓).
𝒙 𝒚 = 𝒇(𝒙) 𝒚 = 𝒇’(𝒙)
−𝟏 𝟏 −𝟏
𝟎 𝟎 𝟏
𝟏 𝟏 𝟎
Answer:-
𝟏
𝒇(𝒙) ≈ 𝑷(𝒙) = (𝟑𝒙𝟓 − 𝟑𝒙𝟒 − 𝟕𝒙𝟑 + 𝟕𝒙𝟐 + 𝟒𝒙) and 𝒇(𝟎. 𝟓) = 𝟎. 𝟔𝟗𝟓𝟑𝟏𝟐𝟓
𝟒
Question # 15:-
Using hermit’s interpolation, find cubic Polynomial from the data, also find 𝒇(𝟎. 𝟓).
𝒙 𝟎 𝟏
𝒚 = 𝒇(𝒙) 𝟎 𝟏
𝒚′ = 𝒇’(𝒙) 𝟎 𝟏
Answer:-
𝟑
𝒇(𝒙) = 𝟐𝒙𝟐 − 𝒙𝟑 , 𝒇(𝟎. 𝟓) =
𝟖
Question # 16:-
Find 𝒇(𝟎. 𝟓) from the data below by hermit’s interpolation formula:
𝒙 𝟎 𝟏
y=𝒇(𝒙) 𝟏 𝟏
y’=𝒇’(𝒙) 𝟎 𝟏
Answer:-
𝟕
𝒇(𝟎. 𝟓) =
𝟖
Question # 17:-
Express 𝒚 as a Polynomial in 𝒙 from the following data, using hermit’s interpolating
formula:
𝒙 −𝟏 0 1
𝒚(𝒙) −𝟏𝟎 -4 −2
𝒚′(𝒙) 𝟏𝟎 3 2
Answer:-
𝒚(𝒙) ≈ 𝑷(𝒙) = 𝒙𝟑 − 𝟐𝒙𝟐 + 𝟑𝒙 − 𝟒
Question # 18:-
Express 𝒇(𝒙) as a Polynomial in 𝒙 from the following data, using hermit’s interpolation
formula.
𝒙 0 1 2
𝒚 = 𝒇(𝒙) 1 2 33
𝒚 = 𝒇′(𝒙) 0 4 64
Answer:-
𝒇(𝒙) ≈ 𝑷(𝒙) = −𝟒𝒙𝟓 + 𝟐𝟏𝒙𝟒 − 𝟐𝟖𝒙𝟑 + 𝟏𝟐𝒙𝟐 + 𝟏
Question # 19:-
Express y as a polynomial in 𝒙 from the following data, using interpolation method.
𝒙 -2 0 1
𝒚(𝒙) 13 -1 1
𝒚′(𝒙) -31 1 5
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) = 𝒙𝟒 + 𝒙 − 𝟏
Question # 20:-
Express y as a polynomial in 𝒙 from the following data, using hermit’s interpolation
method:
𝒙 1 2 3
𝒚(𝒙) -4 5 60
𝒚’(𝒙) 0 24 96
Answer:-
𝒚 (𝒙) = 𝒇 (𝒙) ≈ 𝒙𝟒 − 𝟐 𝒙𝟐 – 𝟑
Question # 21:-
Estimate 𝒇(𝟑. 𝟏𝟕) from the following data using newton’s forward interpolation formula:
Answer:-
𝒇 (𝟑. 𝟏𝟕) = 𝟎. 𝟒𝟑𝟖𝟒
Question # 22:-
Find the forward interpolation polynomial for the data:
𝒙 -1 0 1 2
𝒚 = 𝒇(𝒙) 4 2 2 4
Answer:-
𝒇 (𝒙) = 𝒙𝟐 − 𝒙 + 𝟐
Question # 23:-
Express 𝒇(𝟒𝟐) from the following data using newton’s backward interpolation formula:
𝒙 20 25 30 35 40 45
Answer:-
𝒇 (𝟒𝟐) = 𝟐𝟏𝟖. 𝟔𝟔𝟑𝟎
Question # 24:-
Given:
𝒙 1 2 3 4 5 6 7 8
Find
a): 𝒇(𝟏. 𝟓) b): 𝒇(𝟕. 𝟓)
Answer:-
𝒇 (𝟏. 𝟓) = 𝟑. 𝟑𝟕𝟓 , 𝒇 (𝟕. 𝟓) = 𝟒𝟐𝟏. 𝟖𝟕𝟓
Question # 25:-
Evaluate 𝒇(𝟏. 𝟏) and 𝒇(𝟒. 𝟓) from the table:
𝒙 0 1 2 3 4 5
𝒚 = 𝒇(𝒙) 0 3 8 15 24 35
Answer:-
𝒇 (𝟏. 𝟏) = 𝟑. 𝟒𝟏, 𝒇 (𝟒. 𝟓) = 𝟐𝟗. 𝟐𝟓
Question # 26:-
Compute 𝒇(𝟎. 𝟐𝟑) and 𝒇(𝟎. 𝟐𝟗) using the following data:
𝒙 0 1 2 3 4 5 6 7
Answer:-
𝒇 (𝟎. 𝟓) = 𝟐. 𝟑𝟕𝟓, 𝒇(𝟕. 𝟓) = 𝟒𝟓𝟓. 𝟓𝟑𝟑
Question # 27:-
Compute 𝒇(𝟎. 𝟐𝟑) and 𝒇(𝟎. 𝟐𝟗) using the data:
Answer:-
𝒇(𝟎. 𝟐𝟑) = 𝟏. 𝟔𝟕𝟓𝟏, 𝒇(𝟎. 𝟐𝟗) = 𝟏. 𝟕𝟎𝟖𝟏
Question # 28:-
For the data find the divided difference polynomial and estimate 𝒇(𝟏).
𝒙 -1 0 2 5
𝒚 = 𝒇(𝒙) 7 10 22 235
Answer:-
𝒚 (𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) = 𝟐𝒙𝟑 − 𝒙𝟐 + 𝟏𝟎 , 𝒇 (𝟏) = 𝟏𝟏
Question # 29:-
Using Newton’s divided difference formula, find the value of 𝒇(𝟐), 𝒇(𝟖) and 𝒇(𝟏𝟓) given
the following table:
𝒙 4 5 7 10 11 13
Answer:-
𝒇(𝒙) ≈ 𝑷 (𝒙) = 𝟒𝟖 + 𝟓𝟐 (𝒙 − 𝟒) + 𝟏𝟓(𝒙 − 𝟒) (𝒙 − 𝟓) + (𝒙 − 𝟒) (𝒙 − 𝟓) (𝒙 − 𝟔)
𝒇(𝟐) = 𝟒 , 𝒇 (𝟖) = 𝟒𝟒𝟖, 𝒇 (𝟏𝟓) = 𝟑𝟏𝟓𝟎
Question # 30:-
Use Newton’ s divided difference formula to find 𝒇(𝟖) and 𝒇(𝟏𝟐) from the table:
𝒙 4 5 7 10 11 13
Answer:-
𝒇(𝟖) = 𝟒𝟒𝟖 , 𝒇 (𝟏𝟓) = 𝟑𝟏𝟓𝟎
Question # 31:-
Find the Newton’s divided difference polynomial of the following data: and find 𝒇(𝟐. 𝟓):
𝒙 0 1 3 4
𝒚 = 𝒇(𝒙) 1 4 40 85
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) = 𝒙𝟑 + 𝒙𝟐 + 𝒙 + 𝟏
Question # 32:-
For the following data, find the cubic polynomial using Newton’s divided difference
formula:
𝒙 0 1 2 5
𝒚 = 𝒇(𝒙) 2 3 12 147
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) = 𝒙𝟑 + 𝒙𝟐 – 𝒙 – 𝟐
Question # 33:-
From the following data, find the Newton’s divided difference polynomial:
𝒙 0 2 3 4 7 9
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) =
Question # 34:-
The rocket is launched from the ground and its velocity during first 10 seconds.
1): Study the system using Newton’s interpolation polynomial,
2): Explain your interpolation polynomial physically
3): Find the velocity at 𝒕 = 𝟏 𝒔𝒆𝒄 and 𝒕 = 𝟗 𝒔𝒆𝒄
4): Interpret and give final remarks on your findings.
𝑻𝒊𝒎𝒆 𝒕 0 2 4 6 8 10
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) =
Question # 35:-
Find the missing values in the following data:
𝒙 45 50 55 60 65
Answer:-
𝒇(𝟓𝟎) = 𝟐. 𝟗𝟐𝟓, 𝒇(𝟔𝟎) = 𝟎. 𝟐𝟐𝟓
Question # 36:-
The following table gives pressure of a steam at a given temperature. Using Newton’s
formula, compute the pressure for a temperature of 𝟏𝟒𝟐𝑪.
Answer:-
𝒇(𝟏𝟒𝟐) = 𝟑. 𝟖𝟗𝟖𝟖𝑲𝒈𝒇/𝒄𝒎𝟑
Question # 37:-
Find the missing values in the following data, using Newton’s divided difference formula:
𝒙 3 6 7 8 9 10
Answer:-
𝒇(𝟔) = 𝟏𝟒𝟕, 𝒇(𝟖) = 𝟗𝟑
Question # 38:-
Express y as a polynomial in powers of (𝒙 − 𝟐) from the following data:
𝒙 0 2 3 6 9 10
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑷(𝒙) = (𝒙 − 𝟐)𝟑 + 𝟔(𝒙 − 𝟐)𝟐 + 𝟏𝟎(𝒙 − 𝟐) +
Question # 39:-
Find 𝒇(𝒙) as a polynomial in powers of (𝒙 − 𝟔) from the following data:
𝒙 -1 0 2 3 7 10
Answer:-
𝒇(𝒙) = (𝒙 − 𝟔) + 𝟏𝟑(𝒙 − 𝟔)𝟐 + 𝟓𝟒(𝒙 − 𝟔) + 𝟕𝟑
Question # 40:-
The Pressure drop that occurs when water flows through an orifice meter is measured
using a differential Pressure transmitter. The output current is converted to voltage drop
by a resister. The objective is to correlate the flow rate 𝑭 (𝒈 𝒎𝒊𝒏−𝟏 ) with the voltage drop
𝑷 (𝒎 𝑽). The following data were collected from an experiment:
𝑭 (𝒈 𝒎𝒊𝒏−𝟏 ) 3 5 6 9
(i): Derive a polynomial passing through these data points using Newton’s Divided
interpolation method
(ii): Write Polynomial in simplest form.
(iii): Use this Polynomial to estimate 𝑷 at 𝟕 (𝒈 𝒎𝒊𝒏−𝟏 ) flow rate.
(iv): Interpret and conclude your results.
Answer:-
𝒚(𝒙) = 𝒇 (𝒙) ≈ 𝑷 (𝒙) =
𝒙 1 2 3
𝒚(𝒙) -8 -1 18
Finally write your comments and give suitable interpretation either physical/geometrical
or Mechanical on your finding. What you think !
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑺(𝒙) = 𝟑𝒙𝟑 − 𝟗𝒙𝟐 + 𝟏𝟑𝒙 − 𝟓, 𝟏 ≤ 𝒙 ≤ 𝟐
𝒚(𝟏. 𝟓) = −𝟒𝟓/𝟖, 𝒚’(𝟏) ≈ 𝑺’(𝟏) = 𝟒
Question # 42:-
Using cubic spline, find 𝒚(𝟎. 𝟓) and 𝒚’(𝟏) given that 𝑴𝟎 = 𝑴𝟐 = 𝟎, and the table:
𝒙 0 1 2
𝒚(𝒙) -5 -4 3
Answer:-
𝒚(𝒙) = 𝒇(𝒙) ≈ 𝑺(𝒙) = (𝟑/𝟐)𝒙𝟑 − (𝒙/𝟐) − 𝟓, 𝟎 ≤ 𝒙 ≤ 𝟏
𝒚(𝟎. 𝟓) ≈ 𝑺(𝟎. 𝟓) = −𝟖𝟏/𝟏𝟔, 𝒚’(𝟏) ≈ 𝑺’(𝟏) = 𝟒
Question # 43:-
Find the cubic spline polynomial in each interval for the function given below:
Assume that 𝑴𝟎 = 𝑴𝟑 = 𝟎. Also find 𝒇(𝟐. 𝟓).
𝒙 0 1 2 3
𝒚 = 𝒇(𝒙) 1 2 33 244
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = −𝟒𝒙𝟑 + 𝟓𝒙 + 𝟏, 𝟎 ≤ 𝒙 ≤ 𝟏
Question # 44:-
Find the cubic spline given the table:(assume that 𝑴(𝟎) = 𝟎, 𝑴(𝟑) = −𝟏𝟐)
𝒙 0 2 4 6
𝒚(𝒙) 1 9 41 41
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = 𝒙𝟑 + 𝟏 𝟎 ≤ 𝒙 ≤ 𝟐
Question # 45:-
Obtain the cubic spline approximation for the function 𝒚 = 𝒇(𝒙) from the following data,
given by 𝑴𝟎 = 𝑴𝟑 = 𝟎. Find 𝒚(𝟏. 𝟓).
𝒙 -1 0 1 2
𝒚(𝒙) 0 1 2 18
At the end put down your conclusions and express suitable interpretation either
physical/geometrical or Mechanical on your results. What is your understanding!
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = −𝒙𝟑 − 𝟑𝒙𝟐 − 𝒙 + 𝟏, −𝟏 ≤ 𝒙 ≤ 𝟎
Question # 46:-
Find the cubic spline interpolation polynomial for the data given below under the condition
𝑴(𝟎) = 𝑴(𝟑) = 𝟎 and valid in the sub-interval [𝟏, 𝟐]. Hence, find 𝒇(𝟏. 𝟓):
𝒙 0 1 2 3
𝒚(𝒙) 1 4 10 8
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = (𝟏/𝟑)(−𝟏𝟏𝒙𝟑 + 𝟒𝟓𝒙𝟐 − 𝟒𝟎𝒙 + 𝟏𝟖), 𝟏 ≤ 𝒙 ≤ 𝟐
Question # 47:-
Find the cubic spline polynomial in [𝟎, 𝟏] for the following data:
Also find 𝒚(𝟎. 𝟓) and 𝒚’(𝟏).
𝒙 0 1 2
𝒚 = 𝒇(𝒙) 0 2 6
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = (𝒙𝟑 + 𝟑𝒙)(𝟏/𝟐)
Question # 48:-
Find the cubic spline polynomial for the data. Also find 𝒚(𝟎. 𝟓) and 𝒚’(𝟏).
𝒙 0 1 2
𝒚 = 𝒇(𝒙) 0 1 0
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = (−𝒙𝟑 + 𝟑𝒙)(𝟏/𝟐)
Question # 49:-
Find the natural cubic spline in the range [𝟎, 𝟔] for the following data. Also find 𝒚(𝟑) and
𝒚’(𝟑).
𝒙 0 6 12
𝒚 = 𝒇(𝒙) 1 3 11
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = (𝟏/𝟏𝟒𝟒)(𝒙𝟑 + 𝟏𝟐𝒙 + 𝟏𝟒𝟒)
𝒚(𝟑) = 𝟐𝟎𝟕/𝟏𝟒𝟒, 𝒚’(𝟑) = 𝟑𝟗/𝟏𝟒𝟒
Question # 50:-
Find the cubic spline for the following data with 𝑴(𝟎) = 𝟏𝟎 and 𝑴(𝟐) = 𝟏𝟎
𝒙 -1 0 1
𝒚 = 𝒇(𝒙) 1 0 1
Answer:-
𝒚(𝒙) ≈ 𝑺(𝒙) = −𝟐𝒙𝟑 − 𝒙𝟐 , −𝟏 ≤ 𝒙 ≤ 𝟎
𝒙 5 10 15 20 25
𝒚(𝒙) 16 19 23 26 30
Answer:-
𝒚(𝒙) = 𝟎. 𝟕𝒙 + 𝟏𝟐. 𝟑
Question # 52:-
Find a straight line to the data, using least square method. Hence find 𝒚(𝟐. 𝟓).
𝒙 1 2 3 4 5
𝒚(𝒙) 16 19 23 26 30
Answer:-
𝒚(𝒙) = 𝟑. 𝟓𝒙 + 𝟏𝟐. 𝟑
Question # 53:-
Fit a straight line to the data using least square method. Hence find 𝒚(𝟐. 𝟓).
𝒙 0 1 2 3 4
Answer:-
𝒚(𝒙) = 𝟏. 𝟑𝟑𝒙 + 𝟎. 𝟕𝟐, 𝒚(𝟐) = 𝟒. 𝟎𝟐𝟓
Question # 54:-
Fit a straight line to the data using least square method. Hence find 𝒚(𝟐𝟓).
𝒙 0 5 10 15 20
𝒚(𝒙) 7 11 16 20 26
Answer:-
𝒚(𝒙) = 𝟎. 𝟗𝟒𝒙 + 𝟔. 𝟔, 𝒚(𝟐𝟓) = 𝟑𝟎. 𝟏
Question # 55:-
Fit a straight line of the form 𝒚 = 𝒂𝒙 + 𝒃 to the following data:
𝒙 1 3 5 7 9
Answer:-
𝒚(𝒙) = 𝟎. 𝟓𝟐𝟑𝟐𝒙 + 𝟏. 𝟏𝟖𝟒
Question # 56:-
Fit a parabola to the data using least square method. Also estimate 𝒚(𝟔).
𝒙 1 2 3 4 5
𝒚(𝒙) 5 12 26 60 97
Answer:-
𝒚(𝒙) = 𝟓. 𝟕𝟏𝟒𝟑𝒙𝟐 − 𝟏𝟏. 𝟎𝟖𝟓𝟖𝒙 + 𝟏𝟎. 𝟒𝟎𝟎𝟏
Question # 57:-
Fit a parabola to the data and find y(4.5).
𝒙 1 2 3 4 5
𝒚(𝒙) 2 3 5 8 10
Answer:-
𝒚(𝒙) = 𝟎. 𝟒𝟎𝟑 + 𝟎. 𝟑𝟖𝟖𝒙 − 𝟐. 𝟕𝟗𝟎𝒙𝟐
Question # 58:-
Fit a second-degree polynomial (parabola) for the given data:
𝒙 5 10 15 20 25
𝒚(𝒙) 16 19 23 26 30
Answer:-
𝒚(𝒙) = 𝟏𝟐. 𝟖𝟎𝟕𝟓 + 𝟎. 𝟔𝟏𝟑𝟎𝒙 + 𝟎. 𝟎𝟎𝟐𝟗𝒙𝟐
Question # 59:-
Fit a curve of the form 𝒚(𝒙) = 𝒂𝒙 + 𝒃𝒙𝟐 to the following data by the method of least
square:
𝒙 1 2 3 4 5
Hint:-
Put 𝒀 = 𝒚/𝒙 = 𝒂 + 𝒃𝒙 (straight line case)
Answer:-
𝒚(𝒙) = 𝟏. 𝟑𝟕𝟏𝟖𝒙 + 𝟎. 𝟓𝟐𝟗𝟓𝒙𝟐
Question # 60:-
Fit a curve of the form 𝒙𝒚 = 𝒂 + 𝒃𝒙𝟐 to the following data by the method of least square:
𝒙 1 2 4 6 8
Hint:-
Put 𝒀 = 𝒙𝒚 , 𝑿 = 𝒙𝟐 (straight line case)
Answer:-
𝒙𝒚 = 𝟑. 𝟎𝟐𝟎𝟓 + 𝟐. 𝟑𝟗𝟏𝟖𝒙𝟐
Question # 61:-
Fit a curve of the form 𝒚 = 𝒂𝒙𝒃 to the data:
𝒙 1 2 3 4 5 6
Answer:-
𝒚(𝒙) = 𝟑𝟏𝟔. 𝟗𝟓𝟔𝟖(𝟎. 𝟓𝟔𝟗𝟐)𝒙
Question # 62:-
Fit a curve of the form 𝒚 = 𝒂𝒙𝒃 to the data:
𝒙 1 2 3 4 5 6
Answer:-
𝒚(𝒙) = 𝟐𝟎𝟑𝟓 𝒙−𝟏.𝟕𝟒𝟗𝟒
Question # 63:-
Fit a curve of the form 𝒚 = 𝒂𝒙𝒃 to the data:
𝒙 1 2 3 4 5
Answer:-
𝒚(𝒙) = 𝟕. 𝟏𝟕𝟑𝒙𝟏.𝟗𝟓𝟐
Question # 64:-
Fit a curve of the form 𝒚 = 𝒂𝒆𝒃𝒙 to the data by the method of least squares:
𝒙 0 5 8 12 20
Answer:-
𝒚(𝒙) = 𝟑. 𝟎𝟑𝟎𝟒𝒆−𝟎.𝟏𝟒𝟏𝟏𝐱
Question # 65:-
The following table gives the results of the measurement of Train resistance; 𝑽 is the
Velocity in miles per hours, 𝑹 is the Resistance in pounds per ton:
𝑽 (𝒎𝒊𝒍𝒆𝒔/𝒉𝒐𝒖𝒓𝒔) 10 20 30 40 50
𝑹 (𝒑𝒐𝒖𝒏𝒅𝒔/𝒕𝒐𝒏) 8 10 15 21 30
1): Use the method of Least square to fit the a curve of the form 𝑹 = 𝒂𝑽𝒃 to the above data.
2): Predict 𝑹 at 𝑽 = 𝟑𝟓 𝐦𝐢𝐥𝐞𝐬 𝐩𝐞𝐫 𝐡𝐨𝐮𝐫𝐬 via above relation.
3): How do you see this Exponential relation 𝑹 = 𝒂𝑽𝒃 to fitting this data(It is good!).
4): Give some suitable remarks on your estimation.
Answer:-
𝑹(𝑽) = 𝒇(𝑽) = 𝑷(𝑽) =
Question # 66:-
Determine the values of 𝒂 and 𝒃 so that the equation 𝑸 = 𝒂𝒉𝒃 best fit the following data by
the method of least squares:
𝒉 25 20 12 9 7 5
Answer:-
𝑸 = 𝟎. 𝟎𝟒𝟓𝟏𝒉𝟎.𝟒𝟗𝟏𝟖
Question # 67:-
The following table gives the results of measuring the electrical conductivity C of glass at
temperature Fahrenheit:
Question # 68:-
Number of bacteria “y” in a culture after 𝒙 hours is given in the following table:
𝒙 0 1 2 3 4 5 6
Question # 69:-
An experiment on the life of a cutting tool at different cutting speeds are given below:
Life T 61 26 7 2.6
Question # 70:-
Given the following table:
𝒙 0 1 2 3 4
𝒚(𝒙) 1 5 10 22 38
Find the straight line and the parabola of best fit and calculate the sum of the squares of the
residual in both cases. Which curve is more appropriate and why?
Answer:-
𝒚(𝒔) = 𝟗. 𝟏𝒙 − 𝟑, 𝒚(𝒙) = 𝟐. 𝟐𝒙𝟐 + 𝟎. 𝟑𝒙 + 𝟏. 𝟒
Estraight = 70.7, Eparabola = 2.5, parabola is better
SUMMARY OF CH#2
1. Interpolation:-
Interpolation is the process of finding the value of a function for any value of argument or
independent variable in an interval (𝒙𝟎 , 𝒙𝒏 ).
Thus interpolation is the art of reading between the lines in a given table.
2. Extrapolation:-
Extrapolation is the process of finding the value of a function outside an interval
(𝒙𝟎 , 𝒙𝒏 ).
4. Theorem:-
Let 𝒚(𝒙) = 𝒇(𝒙) be known at the distinct points 𝒙𝟎 , 𝒙𝟏 , … 𝒙𝒏 . Then there exists a unique
polynomial 𝑷(𝒙) of degree less than or equals to 𝒏 and satisfying the condition:
𝑷(𝒙𝒊 ) = 𝒚(𝒙𝒊 ) = 𝒚𝒊 = 𝒇𝒊 , 𝒊 = 𝟎, 𝟏, 𝟐, … . , 𝒏
Where 𝑳𝒊 (𝒙) are called Lagrange’s interpolation coefficients and defined as:
(𝒙−𝒙 )(𝒙−𝒙 )… (𝒙−𝒙 )(𝒙−𝒙 )…(𝒙−𝒙 )
𝑳𝒊 (𝒙): (𝒙𝒊 −𝒙𝟎𝟎)(𝒙𝒊−𝒙𝟏𝟏 )…(𝒙𝒊−𝒙𝒊−𝟏
𝒊−𝟏 𝒊+𝟏 𝒏
)(𝒙𝒊 −𝒙𝒊+𝟏 )…(𝒙𝒊 −𝒙𝒏 ) [ 𝑫𝒆𝒍𝒆𝒕𝒆 𝒊𝒕𝒉 𝒇𝒂𝒄𝒕𝒐𝒓 (𝒙𝒊 − 𝒙𝒊 ) ]
𝒙−𝒙𝟎
where 𝒑 =
𝒉
𝒙−𝒙𝒏
where 𝒑 =
𝒉
𝒇(𝒙𝒏 ) − 𝒇(𝒙𝒏−𝟏 )
𝒇[𝒙𝒏−𝟏 , 𝒙𝒏 ] =
𝒙𝒏 − 𝒙𝒏−𝟏
These are called first divided differences and is devoted by 𝚫𝒇. Higher divided differences
operators are defined as:
for 𝒌 = 𝟑, 𝟒, 𝟓, . . . , 𝒏
𝟏 𝟑 𝟑
𝟏 𝒉𝟐
𝑺(𝒙) = [(𝒙𝒊 − 𝒙) 𝑴𝒊−𝟏 + (𝒙 − 𝒙𝒊−𝟏 ) 𝑴𝒊 ] + (𝒙𝒊 − 𝒙) [𝒚𝒊−𝟏 − 𝑴𝒊−𝟏 ] +
𝟔𝒉 𝒉 𝟔
𝟏 𝒉𝟐
+ 𝒉 (𝒙 − 𝒙𝒊−𝟏 ) [𝒚𝒊 − 𝑴𝒊 ] , 𝒊 = 𝟏, 𝟐, 𝟑, … , 𝒏 (1)
𝟔
𝟔
𝑴𝒊−𝟏 + 𝟒𝑴𝒊 + 𝑴𝒊+𝟏 = 𝒉𝟐 [𝒚𝒊−𝟏 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏 ], 𝐢 = 𝟏, 𝟐, 𝟑, … . . , 𝐧 − 𝟏 (2)
and
𝑴𝟎 = 𝑴𝒏 = 𝟎 (3)
𝒂 ∑ 𝒙𝒊 + 𝒏𝒃 = ∑ 𝒚𝒊
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
13. Fitting a Parabola or fitting a second degree curve by the method of least
squares: OR Second degree approximation:-
Let 𝒚 = 𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 be the best fit parabola. Then the normal equations are:
𝒂 ∑ 𝒙𝟐𝒊 + 𝒃 ∑ 𝒙𝒊 + 𝒏𝒄 = ∑ 𝒚𝒊
𝒂 ∑ 𝒙𝟑𝒊 + 𝒃 ∑ 𝒙𝟐𝒊 + 𝒄 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒚𝒊
By solving these equations, we can determine 𝒂, 𝒃 and 𝒄 to obtain the best fit second-degree
polynomial 𝒚(𝒙) = 𝒇(𝒙) = 𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 .
𝑩 ∑ 𝒙𝒊 + 𝒏𝑨 = ∑ 𝒀𝒊
𝑩 ∑ 𝒙𝟐𝒊 + 𝑨 ∑ 𝒙𝒊 = ∑ 𝒙𝒊 𝒀𝒊
𝒃 ∑ 𝑿𝒊 + 𝒏𝑨 = ∑ 𝒀𝒊
𝒃 ∑ 𝑿𝟐𝒊 + 𝑨 ∑ 𝑿𝒊 = ∑ 𝑿𝒊 𝒀𝒊