Professional Documents
Culture Documents
OBJECTIVE:
1
Lagrange Interpolation
The process of estimating the value of y for any intermediate value of x is called
interpolation within the given range. The process of computing the value of y for a
given value of x that lies outside the table of x is called extrapolation.
Lagrange interpolation
𝑥−𝑥1 𝑥−𝑥0
𝑦=( ) 𝑦0 + ( ) 𝑦1 .
𝑥0 −𝑥1 𝑥1 −𝑥0
Find the linear Lagrange interpolation polynomial fitting the data points below,
and use it to evaluate the value of y at the stated points
(i)
X 2 3
Y 1 5
Solution
2
x0 = 2
y0 = 1
x1 = 3
y1 = 5
𝑥−𝑥1 𝑥−𝑥0
𝑦=( ) 𝑦0 + ( ) 𝑦1 .
𝑥0 −𝑥1 𝑥1 −𝑥0
𝑥−3 𝑥−2
𝑦=( ) (1) + ( ) (5) .
2−3 3−2
𝑦 = 4𝑥 − 7 .
𝑦(2.5) = 4(2.5) − 7 = 3
𝑦(11) = 4(11) − 7 = 37
(ii)
X −3 −5
Y 2 3
𝑦(−3.5)𝑎𝑛𝑑 𝑦(−4)
𝑥−𝑥1 𝑥−𝑥0
𝑦=( ) 𝑦0 + ( ) 𝑦1 .
𝑥0 −𝑥1 𝑥1 −𝑥0
𝑥+5 𝑥+3
𝑦=( ) (2) + ( ) (3) .
−3+5 −5+3
3
−𝑥+1
𝑦= .
2
1 1
𝑦(−3.5) = − (−3.5) + = 2.25
2 2
−1 1
𝑦(−4) = (−4) + = 2.5
2 2
X 1 3 7
Y 2 5 1
𝑦(2)𝑎𝑛𝑑 𝑦(10)
𝑥 − 3) (𝑥 − 7) (𝑥 − 1)(𝑥 − 7)
𝑦= (2) + (5)
(1 − 3)(1 − 7) (3 − 1)(3 − 7)
(𝑥 − 1)(𝑥 − 3)
+ (1)
(7 − 1)(7 − 3)
4
−7𝑥 2 +76𝑥−21
𝑦=
24
−7(2)2 +76(2)−21
𝑦(2) = = 103/24
24
−7(10)2 +76(10)−21
𝑦(10) = =39/24
24
X 5 2 4
Y 1 2 0
𝑦(2)𝑎𝑛𝑑 𝑦(10)
5
Generate a cubic Lagrange interpolating polynomial and use it to find the stated
functional values.
X 2 1 7 4
Y 1 0 2 0
or
6
Taylor’s Series interpolation
(𝑥 − 𝑥0 )2 ′′
′(
(𝑥 − 𝑥0 )3 ′′ ′(𝑥0 )
𝑝(𝑥 ) = 𝑓(𝑥0 ) + (𝑥 − 𝑥0 )𝑓 𝑥0 ) + 𝑓 (𝑥0 ) + 𝑓
2! 3!
(𝑥 − 𝑥0 )𝑛 𝑛
+ 𝑓 (𝑥0 )
𝑛!
Solved problem
Obtain the Taylor’s series expansion about x=1 up to the second degree
1
function𝑓 (𝑥 ) = . Also find the error bound if the approximation is to be used
𝑥 2 +1
around [1,1.4]
Solution
2x
f ′ (x) = − f ′ (x0 ) = f ′ (1) = −1/2
(x2 +1)2
−2+6x2 ′
f ′′ (x) = f (x0 ) = f ′ (1) = 1/2
(x2 +1)3
(𝑥 − 𝑥0 )2 ′′
′(
(𝑥 − 𝑥0 )𝑛 𝑛
𝑃(𝑥 ) = 𝑓(𝑥0 ) + (𝑥 − 𝑥0 )𝑓 𝑥0 ) + 𝑓 (𝑥0 ) + 𝑓 (𝑥0 )
2! 𝑛!
1 (𝑥−1)2 1
𝑃 (𝑥 ) = 1/2 + (𝑥 − 1)(− ) + ( )
2 2! 2
7
1 1 (𝑥−1)2
𝑃 (𝑥 ) = − (𝑥 − 1) + +⋯
2 2 4
1 1 (0.5−1)2
𝑃 (0.5) = − (0.5 − 1) + = 0.8125
2 2 4
1 1
𝑃 (−0.5) = − (−0.5 − 1)+= 1.8125
2 2
(𝑥−1)3
𝑅2 ≤ 𝑀3 𝑤ℎ𝑒𝑟𝑒 𝑀3 = 𝑀𝑎𝑥1≤𝑥≤1.4⃒𝑓 ′′′ (𝑥)⃒
3!
24𝑥(1−𝑥 2 )
𝑓 ′′′ (𝑥 ) =
(1+𝑥 2 )4
24𝑥(1−𝑥 2 )
𝑀3 = 𝑀𝑎𝑥1≤𝑥≤1.4⃒ (1+𝑥 2 )4
⃒ = 2.016 𝑎𝑡 𝑥 = 1.4
(𝑥−1)3
The error bound is (2.016) = 0.336(𝑥 − 1)3
3!
Tutorial problem