Ass# 2 NC G-IV Solved PDF
Ass# 2 NC G-IV Solved PDF
Ass# 2 NC G-IV Solved PDF
Group Members:
M. Iftikhar Uddin Khan Sami (13275)
Raghib Uddin (13273)
Hamza Arif (14446)
Azlan Waseem (15096)
Raja Zaryab (16566)
Assignment#2: (G-4) COURSE TITLE: Numerical Computing
Topic: Polynomial Interpolation and Numerical Integration
Q#1 Using Newton’s forward Formula find the cubic polynomial interpolation
which takes the following values. Evaluate f(1.5).
x 0 1 2 3
f(x) 1 2 1 10
Q#2 Using Newton’s backward Formula find the area of a circle of diameter 88 from
the given table of diameter and area of circle.
Diameter 80 85 90 95 100
Area 5026 5674 6362 7088 7854
Q#5 Find the equation of the curve passing through the points (1, -21), (1, 15), (2,
12), (3, 3). Evaluate f(0), using Newton’s Divided Difference formula.
X 4 5 7 10 11 13
F(x) 48 100 294 900 1210 2028
𝟐𝝅
Q#6 Evaluate the Approximate value of ∫𝟎 𝑪𝒐𝒔𝒙 𝒅𝒙 taking h= /𝟔 .
2
Q#1 Using Newton’s forward Formula find the cubic polynomial interpolation which takes the following
values. Evaluate f(1.5).
x 0 1 2 3
f(x) 1 2 1 10
Solution:
𝐶𝑜𝑛𝑠𝑖𝑑𝑒𝑟𝑖𝑛𝑔 𝑁𝑒𝑤𝑡𝑜𝑛′ 𝑠 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝐹𝑜𝑟𝑚𝑢𝑙𝑎, 𝑖. 𝑒,
𝑢 𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑓 (𝑥) = 𝑦0 + 1! . ∆𝑦0 + 2!
. ∆2 𝑦0 + 3!
. ∆3 𝑦0 + ⋯
𝑥 − 𝑥0
𝑊ℎ𝑒𝑟𝑒, 𝑢=
ℎ
𝑥−0
𝐻𝑒𝑟𝑒, 𝑥0 = 0, ℎ = 1, ∴𝑢= =𝑥
1
𝑁𝑜𝑤, 𝑤𝑒 𝑓𝑜𝑟𝑚 𝑡ℎ𝑒 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝐷𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑇𝑎𝑏𝑙𝑒;
𝒙 𝒚 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚
𝑥0 = 0 𝒚𝟎 = 𝟏
𝟐−𝟏= 𝟏
𝑥1 = 1 𝑦1 = 2 −𝟏 − 𝟏 = −𝟐
1 − 2 = −1 𝟏𝟎 − (−𝟐) = 𝟏𝟐
𝑥2 = 2 𝑦2 = 1 9 − (−1) = 10
10 − 1 = 9
𝑥3 = 3 𝑦3 = 10
𝑆𝑜, 𝑁𝑜𝑤, 𝑊𝑒 ℎ𝑎𝑣𝑒; 𝑦0 = 1, ∆𝑦0 = 1, ∆2 𝑦0 = −2, ∆3 𝑦0 = 12
𝑢 𝑢 (𝑢 − 1) 𝑢 (𝑢 − 1)(𝑢 − 2)
𝑓 (𝑥) = 1 + . (1) + . (−2) + . (12)
1! 2! 3!
𝑢 𝑢 (𝑢 − 1) 𝑢 (𝑢 − 1)(𝑢 − 2)
𝑓 (𝑥) = 1 + . (1) + . (−2) + . (12)
1 2 6
𝑓 (𝑥) = 1 + 𝑢 + {𝑢(𝑢 − 1). (−1)} + {𝑢(𝑢 − 1)(𝑢 − 2). (2)}
3
Q#2 Using Newton’s backward Formula find the area of a circle of diameter 88 from the given table of
diameter and area of circle.
Diameter 80 85 90 95 100
Area 5026 5674 6362 7088 7854
Solution:
𝒙 𝒚 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚 ∆𝟒 𝒚
𝑥0 = 80 𝑦0 = 5026
5674 − 5026
= 648
𝑥1 = 85 𝑦1 = 5674 688 − 648
= 40
6362 − 5674 38 − 40 = −2
= 688
𝑥2 = 90 𝑦2 = 6362 726 − 688 𝟐+𝟐=𝟒
= 38
7088 − 6362 𝟒𝟎 − 𝟑𝟖 = 𝟐
= 726
𝑥3 = 95 𝑦3 = 7088 𝟕𝟔𝟔 − 𝟕𝟐𝟔
= 𝟒𝟎
𝟕𝟖𝟓𝟒 − 𝟕𝟎𝟖𝟖
= 𝟕𝟔𝟔
𝑥4 = 100 𝒚𝟒 = 𝟕𝟖𝟓𝟒
𝐻𝑒𝑛𝑐𝑒; 𝑦𝑛 = 7854, ∇𝑦𝑛 = 766, ∇2 𝑦𝑛 = 40, ∇3 𝑦𝑛 = 2, ∇4 𝑦𝑛 = 4
4
Q#3 The specific gravities of Zinc sulphate solutions of different concentration at 15𝑪𝟎 are given below.
Concentration(%) 10 12 14 16 18 20 22
Specific Gravity 1.059 1.073 1.085 1.097 1.110 1.124 1.137
𝟎
Find the specific Gravity of 15.8% solution at 15𝑪 , using Gauss’s Backward formula.
Solution:
𝐶𝑜𝑠𝑖𝑑𝑒𝑟𝑖𝑛𝑔 𝐺𝑎𝑢𝑠𝑠 ′ 𝐵𝑎𝑐𝑘𝑤𝑎𝑟𝑑 𝐹𝑜𝑟𝑚𝑢𝑙𝑎; ; ;
𝑢(𝑢+1) 𝑢(𝑢−1)(𝑢+1) 𝑢(𝑢+1)(𝑢−1)(𝑢−2)
𝑓(𝑥) = 𝑦0 + 𝑢∆𝑦0 + 2!
∆2 𝑦−1 + 3!
∆3 𝑦−2 + 4!
∆4 𝑦−3 + ⋯
𝑥 − 𝑥0
𝑊ℎ𝑒𝑟𝑒, 𝑢= 𝑎𝑛𝑑 𝑥0 𝑖𝑠 𝑡ℎ𝑒 𝑜𝑟𝑖𝑔𝑖𝑛.
ℎ
𝐻𝑒𝑟𝑒, 𝑥0 = 16, ℎ = 2, 𝑠𝑖𝑛𝑐𝑒 𝑥 = 15.8 𝑙𝑖𝑒𝑠 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 𝑥 = 14 𝑎𝑛𝑑 𝑥 = 16
𝑥 − 16 15.8 − 16 0.2
𝑢= , => 𝑊ℎ𝑒𝑛 𝑥 = 15.8 => 𝑢 = => − => −0.1
2 2 2
𝑁𝑜𝑤, 𝑊ℎ𝑒 𝑓𝑜𝑟𝑚 𝑡ℎ𝑒 𝐶𝑒𝑛𝑡𝑟𝑎𝑙 𝐷𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑇𝑎𝑏𝑙𝑒;
𝒙 𝒖 𝒚 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚 ∆𝟒 𝒚 ∆𝟓 𝒚 ∆𝟔 𝒚
10 -3 1.059
0.014
12 -2 1.073 −0.002
0.012 0.002
14 -1 1.085 0 −0.001
0.012 0.001 0
16 0 1.097 −−−− 0.001 −−−− −𝟎. 𝟎𝟎𝟏 −−−− −𝟎. 𝟎𝟎𝟏
0.013 0 −0.001
18 1 1.110 0.001 −0.002
0.014 -0.002
20 2 1.124 −0.001
0.013
22 3 1.137
𝑆𝑜, 𝑁𝑜𝑤, 𝑊𝑒 ℎ𝑎𝑣𝑒; 𝑦0 = 1.097, ∆𝑦−1 = 0.012, ∆2 𝑦−1 = 0.001, ∆3 𝑦−2 = 0.001,
∆4 𝑦−2 = −0.001, ∆5 𝑦−3 = 0, ∆6 𝑦−3 = −0.001
𝑢(𝑢 + 1) 𝑢(𝑢 − 1)(𝑢 + 1)
𝑓 (𝑥) = 1.097 + 𝑢 X 0.012 + X 0.001 + X 0.001
2! 3!
𝑢(𝑢 − 1)(𝑢 + 2)(𝑢 + 1) 𝑢(𝑢 − 1)(𝑢 + 2)(𝑢 − 2)(𝑢 + 1)
+ X (−0.001) + .0
4! 5!
𝑢(𝑢 − 1)(𝑢 + 2)(𝑢 − 2)(𝑢 + 3)(𝑢 + 1)
+ X (−0.001)
6!
(−0.1)((−0.1) + 1) (−0.1)((−0.1) − 1)((−0.1) + 1)
𝑓 (𝑥) = 1.097 + (−0.1) X 0.012 + X 0.001 + X 0.001
2! 3!
(−0.1)((−0.1) − 1)((−0.1) + 2)((−0.1) + 1)
+ X (−0.001)
4!
(−0.1)((−0.1) − 1)((−0.1) + 2)((−0.1) − 2)((−0.1) + 1)
+ .0
5!
(−0.1)((−0.1) − 1)((−0.1) + 2)((−0.1) − 2)((−0.1) + 3)((−0.1) + 1)
+ X (−0.001)
6!
∵ 𝑢 = −0.1 (𝑚𝑒𝑛𝑡𝑖𝑜𝑛𝑒𝑑 𝑎𝑏𝑜𝑣𝑒)
𝑓 (15.8) = 1.097 − 0.0012 − 0.000045 + 0.0000165 − 0.00000784 + 0 + 0.00000159
5
Q#4 Using Lagrange’s Formula, Evaluate f(8).
X 5 7 11 13 17
Y=xf(x) 150 392 1452 2366 5202
Solution:
6
Q#5 Evaluate f(0), using Newton’s Divided Difference formula.
X 4 5 7 10 11 13
F(x) 48 100 294 900 1210 2028
Solution:
𝒙 𝒚 𝑰 𝑫𝑫 𝑰𝑰 𝑫𝑫 𝑰𝑰𝑰 𝑫𝑫 𝑰𝑽 𝑫𝑫 𝑽 𝑫𝑫
𝑥0 = 4 𝒚𝟎 = 𝟒𝟖
𝟏𝟎𝟎 − 𝟒𝟖
= 𝟓𝟐
𝟓−𝟒
𝑥1 = 5 𝑦1 = 100 𝟗𝟕 − 𝟓𝟐
= 𝟏𝟓
𝟕−𝟒
294 − 100 𝟐𝟏 − 𝟏𝟓
= 97 =𝟏
7−5 𝟏𝟎 − 𝟒
𝑥2 = 7 𝑦2 = 294 202 − 97 𝟏−𝟏
= 21 =𝟎
10 − 5 𝟏𝟏 − 𝟒
900 − 294 27 − 21 𝟎−𝟎
= 202 =1 =𝟎
10 − 7 11 − 5 𝟏𝟑 − 𝟒
𝑥3 = 10 𝑦3 = 900 310 − 202 1−1
= 27 =0
11 − 7 13 − 5
1210 − 900 33 − 27
= 310 =1
11 − 10 13 − 7
𝑥4 = 11 𝑦4 = 1210 409 − 310
= 33
13 − 10
2028 − 1210
= 409
13 − 11
𝑥5 = 13 𝑦5 = 2028
𝑆𝑜, 𝑁𝑜𝑤, 𝑊𝑒 ℎ𝑎𝑣𝑒;
𝑓 (𝑥) = 48 + (𝑥 − 4)(52) + (𝑥 − 4)(𝑥 − 5)(15) + (𝑥 − 4)(𝑥 − 5)(𝑥 − 7)(1) + 0
𝑊ℎ𝑒𝑛 𝑓(0),
𝑓 (0) = 48 + (0 − 4)(52) + (0 − 4)(0 − 5)(15) + (0 − 4)(0 − 5)(0 − 7)(1) + 0
𝑓 (0) = 48 + (−4)(52) + (−4)(−5)(15) + (−4)(−5)(−7)(1) + 0
7
𝟐𝝅
Q#6 Evaluate the Approximate value of ∫𝟎 𝑪𝒐𝒔𝒙 𝒅𝒙 taking h= 𝝅/𝟔 .
Solution:
2𝜋
𝜋 2𝜋 2𝜋. 6 12𝜋
𝐺𝑖𝑣𝑒𝑛 𝑡ℎ𝑎𝑡; ∫ 𝐶𝑜𝑠𝑥 𝑑𝑥 , ℎ= , 𝑛=𝜋 = = = 12
0 6 ⁄6 𝜋 𝜋
2𝜋
𝜋
∫ 𝐶𝑜𝑠𝑥 𝑑𝑥 = 6 [(1 + 1) + 4(0.866 + 0 − 0.866 − 0.866 + 0 + 0.866) + 2(0.5 − 0.5 − 1 − 0.5 + 0.5)]
0 3
2𝜋
∫ 𝐶𝑜𝑠𝑥 𝑑𝑥 = 𝜋⁄2 . [(2) + 4(0) + 2(−1)] = 𝜋⁄2 . [2 − 2] = 0 ==> 𝐴𝑛𝑠 …
0