Ass# 2 NC G-IV Solved
Ass# 2 NC G-IV Solved
Ass# 2 NC G-IV Solved
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
Concentration(%) 10 12 14 16 18 20 22
Specific Gravity 1.059 1.073 1.085 1.097 1.110 1.124 1.137
0
Find the specific Gravity of 15.8% solution at 15C , using Gauss’s Backward formula.
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
2π
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:
f ( x )=1+u−u2 +u+2 u3−6 u 2+ 4 u=1+ u+u+ 4 u−u 2−6 u2 +2u 3=1+6 u−7u 2+ 2u3
4
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:
x y ∆y ∆2 y ∆3 y ∆4 y
x 0=80 y 0=5026
5674−5026=648
x 1=85 y 1=5674 688−648=40
6362−5674=688 38−40=−2
x 2=90 y 2=6362 726−688=38 2+2=4
7088−6362=726 40−38=2
x 3=95 y 3=7088 766−726=40
7854−7088=766
x 4 =100 y 4 =7854
Hence ; y n=7854 , ∇ y n=766 , ∇ 2 y n=40 , ∇ 3 y n=2, ∇ 4 y n=4
¿ When x=88∧u=−0.4
Substituting all the values∈Equ(i)
5
Q#3 The specific gravities of Zinc sulphate solutions of different concentration at 15 C 0 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 15C 0, using Gauss’s Backward formula.
Solution:
Cosidering Gaus s ' Backward Formula ; ; ;
u(u+1) 2 u(u−1)(u+ 1) 3 u(u +1)(u−1)( u−2) 4
f ( x )= y 0+¿ u ∆ y 0 + ∆ y −1 + ∆ y−2+ ∆ y−3 +…
2! 3! 4!
x−x 0
Where , u= ∧x 0 is the origin .
h
Here , x 0=16 , h=2 , since x=15.8 lies between x=14∧x=16
6
Q#4 Using Lagrange’s Formula, Evaluate f(8).
X 5 7 11 13 17
Y=xf(x) 150 392 1452 2366 5202
Solution:
Given the values of x∧ y are x 0 =5 , x 1=7 , x 2=11, x 3=13 , x 4 =17
The values arenot equally spaced , So we use Lagrang e' s Formula ¿ find y=f ( x ) .
7
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:
x y I DD II DD III DD IV DD V DD
x 0=4 y 0=48
100−48
=52
5−4
x 1=5 y 1=100 97−52
=15
7−4
294−100 21−15
=97 =1
7−5 10−4
x 2=7 y 2=294 202−97 1−1
=21 =0
10−5 11−4
900−294 27−21 0−0
=202 =1 =0
10−7 11−5 13−4
x 3=10 y 3=900 310−202 1−1
=27 =0
11−7 13−5
1210−900 33−27
=310 =1
11−10 13−7
x 4 =11 y 4 =1210 409−310
=33
13−10
2028−1210
=409
13−11
x 5=13 y 5=2028
So , Now , We have ;
f ( x )=48+ ( x−4 ) ( 52 )+ ( x−4 )( x−5 )( 15 ) + ( x−4 )( x−5 ) ( x−7 ) ( 1 ) +0
When f ( 0 ) ,
f ( 0 )=48+ ( 0−4 )( 52 ) + ( 0−4 )( 0−5 ) ( 15 ) + ( 0−4 )( 0−5 ) ( 0−7 )( 1 ) +0
f ( 0 )=48+ (−4 )( 52 ) + (−4 ) (−5 ) ( 15 ) + (−4 ) (−5 ) (−7 ) (1 )+ 0
f ( 0 )=48−( 4 ) ( 52 )+ ( 20 )( 15 )−(140) ( 1 )+ 0
f ( 0 )=48−208+300−140+0=¿=¿ 0 Ans …
8
2π
Q#6 Evaluate the Approximate value of ∫ Cosx dx taking h= π /6 .
0
Solution:
2π
π 2 π 2 π .6 12 π
Given that ; ∫ Cosx dx , h= , n= = = =12
0 6 π π π
6
Here , y =cos x dx . The intervalis[ 0,2 π ]
We shall find the values of y∧they are givenby thetable below .
π π π 2π 5π 7π 4π 3π 5π 11π
x 0 π 2π
6 3 2 3 6 6 3 2 3 6
0.86
y=f ( x ) 1 0.5 0 -0.5 -0.866 -1 -0.866 -0.5 0 0.5 0.866 1
6
¿> cos( x ) y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y 10 y 11 y 12
By Trapezoidal Rule ,
2π
y 0 + y 12
∫ Cosx dx=h
0
[ 2
+ y1 + y 2 + y 3 + y 4 + y5 + y 6 + y 7 + y 8+ y 9+ y10 + y 11 ]
2π
∫ Cosx dx= π6 . [ 1+ 1
2
+0.866+ 0.5+0−0.5−0.866−1−0.866−0.5+ 0+0.5+0.866 ]
0
2π
∫ Cosx dx= π6 . [ 1+ 1
2 ]
−1 =0=¿> Ans …
0
1
By Simpso n' s Rule ,
3
2π
π
2π
6
∫ Cosx dx= 3 [ (1+ 1)+ 4(0.866+ 0−0.866−0.866+ 0+0.866)+2(0.5−0.5−1−0.5+0.5)]
0
2π