Assignment 6 Ans
Assignment 6 Ans
QUESTION 1:
How many polynomials, do we have, of order ≤ 4 passing through exactly 5 data points?
a. 1
b. 2
c. 4
d. 5
Correct Answer: a .
Solution:
For 𝑛 + 1 data points there is one and only one polynomial of order ≤ 𝑛 that passes through
all the points.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 2:
If 𝑃(𝑥 ) is the polynomial that interpolates the function 𝑓 (𝑥 ) = sin x at 4 data points on the
interval [0,1]. What is the greatest possible error up to four decimal places?
a. 0.0002
b. 0.0034
c. 0.0105
d. 0.0416
Correct Answer: d .
Solution:
The error in interpolating polynomial is given by
𝑓 (𝑛+1) (𝜉 )
𝐸𝑛 (𝑥 ) = (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛 )
(𝑛 + 1)!
We have 𝑛 + 1 = 4
𝑓 (𝑛+1) (𝜉 ) = 𝑓 (4) (𝜉 ) = sin 𝜉
The largest possible error would be the maximal value of
3
1
| 𝑓 (4) (𝜉 ) ∏(𝑥 − 𝑥𝑖 )|
4!
𝑖=0
QUESTION 3:
Let 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 are the consecutive nodal points. Which of the following option(s) is (are)
CORRECT for a small step size ℎ?
Correct Answer: a, b, c, d .
Solution:
The forward difference operator is
Δ𝑓 (𝑥𝑖 ) = 𝑓 (𝑥𝑖 + ℎ) − 𝑓 (𝑥𝑖 )
The backward difference operator is
∇𝑓 (𝑥𝑖 ) = 𝑓 (𝑥𝑖 ) − 𝑓 (𝑥𝑖 − ℎ)
Now, the higher order differences are
Δ2 𝑓(𝑥𝑖 ) = 𝑓(𝑥𝑖+2 ) − 2𝑓 (𝑥𝑖+1 ) + 𝑓(𝑥𝑖 )
∇2 𝑓 (𝑥𝑖 ) = 𝑓 (𝑥𝑖 ) − 2𝑓(𝑥𝑖−1 ) + 𝑓(𝑥𝑖−2 )
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 4:
Which of the following is the Newton’s forward difference interpolating polynomial based on 3
nodal points 𝑥0 , 𝑥1 , 𝑥2 ?
Δ𝑓0 Δ2 𝑓0
a. 𝑓(𝑥0 ) + (𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
ℎ 2!ℎ 2
∇𝑓2 ∇2 𝑓2
b. 𝑓(𝑥2 ) + (𝑥 − 𝑥2 ) + (𝑥 − 𝑥2 )(𝑥 − 𝑥1 ) 2!ℎ2
ℎ
Δ𝑓2 Δ2 𝑓
c. 𝑓(𝑥2 ) + (𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) 2!ℎ22
ℎ
∇𝑓0 ∇2 𝑓
d. 𝑓(𝑥0 ) + (𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) 2!ℎ02
ℎ
Correct Answer: a .
Solution:
The generalized Newton’s forward difference interpolating polynomial based on (𝑛 + 1) data
points 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 is given by
Δ𝑓0 Δ2 𝑓0
𝑃𝑛 (𝑥 ) = 𝑓 (𝑥0 ) + (𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) +⋯
ℎ 2! ℎ2
𝑛
Δ 𝑓0
+ (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
𝑛! ℎ𝑛
For 𝑛 + 1 = 3 nodal points, the Newton’s forward difference interpolating polynomial would be
Δ𝑓0 Δ2 𝑓0
𝑃2 (𝑥 ) = 𝑓 (𝑥0 ) + (𝑥 − 𝑥0 ) ( )(
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 )
ℎ 2! ℎ2
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 5:
Using Newton’s forward interpolation formula, find the polynomial of degree 2 or less which
takes the following values
Correct Answer: c .
Solution:
The Newton’s forward interpolating polynomial for 3 nodal points is given by
Δ𝑓0 Δ2 𝑓0
𝑃2 (𝑥 ) = 𝑓 (𝑥0 ) + (𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
ℎ 2! ℎ2
Here, 𝑓 (𝑥0 ) = 2.5,
Δ𝑓0 = 𝑓1 − 𝑓0 = 1.9 − 2.5 = −0.6
Δ2 𝑓0 = 𝑓2 − 2𝑓1 + 𝑓0 = 0.6 − 2 × 1.9 + 2.5 = −0.7
Hence, the interpolating polynomial is
−0.6 −0.7
𝑃2 (𝑥 ) = 2.5 + (𝑥 − 0.5) + (𝑥 − 0.5)(𝑥 − 1.5)
1 2 ⋅ 12
= 2.5 − 0.6𝑥 + 0.3 − 0.35(𝑥 2 − 2𝑥 + 0.75)
= 2.8 − 0.6𝑥 − 0.35𝑥 2 + 0.7𝑥 − 0.2625
= −0.35𝑥 2 + 0.1𝑥 + 2.5375
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 6:
Use Newton’s backward interpolation formula to estimate the value of 𝑓 (1) from the following
table.
𝑥 0 2 4
𝑓(𝑥) 1 3.5 5.5
The value is
a. 1.5789
b. 2.1325
c. 1.9654
d. 2.3125
Correct Answer: d .
Solution:
The Newton’s backward interpolation formula for 3 nodal points is given by
∇𝑓2 ∇2 𝑓2
𝑃2 (𝑥 ) = 𝑓 (𝑥2 ) + (𝑥 − 𝑥2 ) + (𝑥 − 𝑥2 )(𝑥 − 𝑥1 )
ℎ 2! ℎ2
Here, 𝑓 (𝑥2 ) = 5.5
2 −0.5
𝑃2 (𝑥 ) = 5.5 + (𝑥 − 4) ⋅ + (𝑥 − 4)(𝑥 − 2) ⋅
2 2 ⋅ 22
0.5 2
= 5.5 + (𝑥 − 4) − (𝑥 − 6𝑥 + 8)
8
= 1 + 1.375𝑥 − 0.0625𝑥 2
QUESTION 7:
The Lagrange interpolation polynomial for the given data points
𝑥 1 2 3
𝑓(𝑥) 2 7 5
is
a. −7𝑥 2 + 31𝑥 − 20
b. −3.5𝑥 2 + 15.5𝑥 − 10
c. 7𝑥 2 − 31𝑥 + 20
d. 3.5𝑥 2 − 15.5𝑥 + 10
Correct Answer: b .
Solution
The Lagrange interpolating polynomial for three data points is
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
𝑃2 (𝑥 ) = 𝑓(𝑥0 ) + 𝑓(𝑥1 ) + 𝑓(𝑥2 )
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )
(𝑥 − 2)(𝑥 − 3) (𝑥 − 1)(𝑥 − 3) (𝑥 − 1)(𝑥 − 2)
= 𝑓(1) + 𝑓(2) + 𝑓(3)
(1 − 2)(1 − 3) (2 − 1)(2 − 3) (3 − 1)(3 − 2)
5
= (𝑥 − 2)(𝑥 − 3) − 7(𝑥 − 1)(𝑥 − 3) + (𝑥 − 1)(𝑥 − 2)
2
2(𝑥 − 2)(𝑥 − 3) − 14(𝑥 − 1)(𝑥 − 3) + 5(𝑥 − 1)(𝑥 − 2)
=
2
1
= [2(𝑥 2 − 5𝑥 + 6) − 14(𝑥 2 − 4𝑥 + 3) + 5(𝑥 2 − 3𝑥 + 2)]
2
1
= [2𝑥 2 − 10𝑥 + 12 − 14𝑥 2 + 56𝑥 − 42 + 5𝑥 2 − 15𝑥 + 10]
2
1
= [−7𝑥 2 + 31𝑥 − 20] = −3.5𝑥 2 + 15.5𝑥 − 10
2
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 8:
For the following table
𝑥 10 20 30 40
𝑓(𝑥) 20 60 80 100
Which of the following option(s) is (are) CORRECT?
Correct Answer: b, c .
Solution:
𝑓 (𝑥𝑖+1 ) − 𝑓 (𝑥𝑖 )
𝑓 [𝑥𝑖+1 , 𝑥𝑖 ] =
𝑥𝑖+1 − 𝑥𝑖
QUESTION 9:
Using trapezoidal rule, evaluate the integral
4
1
∫ 2
𝑑𝑥
0 1+𝑥
for 4 equal sub-intervals. The value of the integral is
a. 2.658
b. 1.329
c. 0.886
d. 3.987
Correct Answer: b .
Solution:
The trapezoidal rule is
𝑥𝑛 𝑛−1
ℎ
∫ 𝑓 (𝑥 ) 𝑑𝑥 = [𝑓(𝑥0 ) + 2 ∑ 𝑓 (𝑥𝑖 ) + 𝑓(𝑥𝑛 )]
𝑥0 2
𝑖=1
4
1 1 1 1 1 1 1
∫ 2
𝑑𝑥 = [ 2
+ 2( 2
+ 2
+ 2
)+ ]
0 1+𝑥 2 1+0 1+1 1+2 1+3 1 + 42
1 1 1 1 1
= [1 + 2 ( + + ) + ]
2 2 5 10 17
1 2 1 1
= [1 + 1 + + + ]
2 5 5 17
2.658
= = 1.329
2
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 10:
Using Simpson’s 1/3rd rule, evaluate the integral
1
𝑥2
∫ 3
𝑑𝑥
0 1+𝑥
for two equal size sub-intervals. The value of the integral is
a. 1.56
b. 0
c. 0.231
d. 0.562
Correct Answer: c .
Solution:
Using Simpson’s 1/3rd rule says
𝑏
ℎ 𝑎+𝑏
∫ 𝑓(𝑥) 𝑑𝑥 = [𝑓 (𝑎) + 4𝑓 ( ) + 𝑓(𝑏)]
𝑎 3 2
𝑥2
1 0.5 02 0.52 12
∫ 3
𝑑𝑥 = [ +4 + ]
0 1+𝑥 3 1 + 03 1 + 0.53 1 + 13
0.5 1 1
= [0 + + ]
3 1.125 2
= 0.231