INTERNAL ASSIGNMENT
Centre for Distance & Online Education
NAME OF CANDIDATE: ARCHISMAN ROY
ROLL NO.: 2414106489
SESSION: APRIL 2025
PROGRAM: BACHELOR OF COMPUTER APPLICATIONS (BCA)
SEMESTER: 03
COURSE CODE & NAME: DCA2101 -COMPUTER ORIENTED NUMERICAL METHODS
Page 1 of 7
SET-1
Ans1. Let f(x) be a function defined at discrete points with step size h.
Definitions:
Forward difference (Δ) : ( ) ( ) ( )
Backward difference (∇) :∇ ( ) ( ) ( )
( ) ( )
Central difference (δ) : ( )
Show that ( )
( ( ) ( ))
( ( ) ( ) ( ) ( ))
( ) ( )
Hence Proved
Show that Δ−∇=Δ∇
( ∇) ( ) ( ) ∇ ( )
[ ( ) ( )] [ ( ) ( )]
( ) ( ) ( ) …… equation (i)
∇ ( ) [∇ ( )]
[ ( ) ( )]
[ ( ) ( )] [ ( ) ( )]
( ) ( ) ( ) …… equation (ii)
Hence proved since equation i & ii are equal.
Ans.2: The equations are 3x + 20y – z = –18, 2x– 3y + 20z = 25, 20x + y – 2z = 17.
….. from equation (iii)
,…… from equation(i)
…… from equation (ii)
Initial values: x = 0.00, y = 0.00, z = 0.00
Iteration 1:
x = (17 – 0 + 2 × 0) / 20 =0.85
y = (−18 −3 × 0 + 0)/ 20 = −0.90
z = (25 −2 × 0 + 3 × 0) / 20 =1.25
(x , y, z) = (0.85, −0.90, 1.25)
Iteration 2:
x = (17− (−0.90) + 2×1.25) / 20 = 1.02
y = (−18 −3×0.85 + 1.25) / 20 =−0.96
z = (25 −2×0.85 + 3 × (−0.90)) / 20 =1.03
(x, y, z) = (1.02, −0.96, 1.03)
Iteration 3:
x = (17− (−0.96) + 2×1.03) / 20 = 1.00
y = (−18 − 3×1.02 + 1.03) / 20 = −1.00
z = (25−2×1.02 + 3 × (−0.96)) / 20=1.00
(x, y, z)=(1.00, −1.00, 1.00 )
The final solution obtained is x = 1.00, y = −1.00 and z = 1.00
Page 2 of 7
Ans.3: We are asked to fit a straight line of the form: y = ax + b to the given data using the
Method of Moments.
Given data:
x y
2 27
3 40
4 55
5 68
Let there be n = 4 data points.
The method of moments involves matching the moments:
∑ y = a ∑ x + bn
∑ xy = a∑ x² + b∑x
We compute the required sums:
x y x² xy
2 27 4 54
3 40 9 120
4 55 16 220
5 68 25 340
Now compute:
∑ x = 2 + 3 + 4 + 5 = 14
∑ y = 27 + 40 + 55 + 68 = 190
∑ x² = 4 + 9 + 16 + 25 = 54
∑ xy = 54 + 120 + 220 + 340 = 734
190 = a(14) + b(4) → Equation (1)
14a + 4b = 190
734 = a(54) + b(14) → Equation (2)
54a + 14b = 734
We solve using substitution or elimination. Let's use elimination.
Multiply Equation (1) by 14:
14a + 4b = 190 × 14
⇒196a + 56b = 2660
Multiply Equation (2) by 4:
54a + 14b = 734×4
⇒216a + 56b = 2936
Now subtract (3) from (4):
(216a−196a) + (56b−56b) = 2936−2660
20a = 276
⇒a = 276 / 20 = 13.8
Now substitute a =13.8, a = 13.8 into Equation (1):
14a + 4b = 190
⇒14 (13.8) + 4b = 190
⇒193.2 + 4b = 190
Page 3 of 7
⇒4b = −3.2
⇒b = −0.8
The best-fit straight line is: y = 13.8, x = −0.8
SET-2
Ans.4: We are to apply Gauss Forward Interpolation Formula to find the value of f(x) at
x=3.5, given the table:
x f(x)
1.5 8.963
2.5 24.364
3.5 66.340
4.5 180.034
We need equal spacing between x values.
Check:
h = 2.5 − 1.5 = 1.0 (uniform step)
Index the data using:
i x f(x) Δf Δ²f Δ³f
0 1.5 8.963
1 2.5 24.364
2 3.5 66.340
3 4.5 180.034
Now compute forward differences (Δ):
First difference (Δf):
Δf0 = 24.364 − 8.963 = 15.401
Δf1 = 66.340 − 24.364 = 41.976
Δf2 = 180.034 − 66.340 = 113.694
Second difference (Δ²f):
Δ2f0 = 41.976 − 15.401 = 26.575
Δ2f1 = 113.694 − 41.976 = 71.718
Third difference (Δ³f):
Δ3f0 = 71.718 − 26.575 = 45.143
So the complete table:
i x f(x) Δf Δ²f Δ³f
0 1.5 8.963 15.401 26.575 45.143
1 2.5 24.364 41.976 71.718
2 3.5 66.340 113.694
3 4.5 180.034
Page 4 of 7
Step 2: Gauss Forward Interpolation Formula
Gauss Forward Formula (symmetric form around middle point) is:
f(x) = f0 + pΔf0 +[ p(p−1).Δ2f0 ] / 2! + [p(p−1)(p−2).Δ3f0 ] / 3!+ ⋯
Choose origin near middle point. Since we are to find f (3.5), let us choose origin at x0 =3.5
(i = 2). This helps us use forward Gauss formula.
Set x0 = 3.5, h=1, so:
p = x−x0h = 3.5−3.51 = 0
Now substitute into Gauss forward formula centered at x=3.
Let:
f0 = f(3.5) = 66.340
Since p = 0, all terms with p vanish
Thus: f(3.5) = 66.340 Ans.
Ans.5: Let: f(x) = 1 / (1+ x2)
i. Part A: Simpson’s 3/8 Rule
The Simpson’s 3/8 rule formula is:
∫ab f(x) dx = 3h/8 [(y0 + yn) + 3(y1 + y2 + y4 + y5 + …. + yn-1) + 2(y3 + y6 + y9 + ….. + yn-3)]
Requires n to be a multiple of 3.
Let’s take n = 6 (a multiple of 3).
h = (12− 0) / 6 = 2
So, the x-values:
x0= 0, x1 = 2, x2 = 4, x3 = 6, x4 = 8, x5 = 10, x6 = 12
Now compute f(xi):
xi f(xi)=1/(1+xi2 )
0 1
2 1/(1+4) = 0.21/(1+4) = 0.2
4 1/(1+16) = 0.05881/(1+16) = 0.0588
6 1/(1+36) = 0.02701/(1+36) = 0.0270
8 1/(1+64) = 0.01541/(1+64) = 0.0154
10 1/(1+100) = 0.00991/(1+100) = 0.0099
12 1/(1+144) = 0.00691/(1+144) = 0.0069
Now apply 3/8 Rule:
I ≈ 3h/8 [f0 + 3f1 + 3f2 + 2f3 + 3f4 + 3f5 +f6]
Substitute values:
I ≈ 3(2)/8 [1 + 3(0.2) + 3(0.0588) + 2(0.0270) + 3(0.0154) + 3(0.0099) + 0.0069]
= 6/8 × [1 + 0.6 + 0.1764 + 0.054 + 0.0462 + 0.0297 + 0.0069]
= 0.75 × (1.9132)
≈ 1.4349
Simpson’s 1/3 Rule
Formula: ∫ab f(x) dx ≈ h / 3[f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + … + f(xn)]
Requires even number of intervals: Use n = 6 (same as above)
We already have:
Page 5 of 7
h = 2, x0 = 0, ..., x6= 12
Apply formula:
I ≈ 2/3[f0+4f1+2f2+4f3+2f4+4f5+f6]
Substitute values:
I≈2/3[1+4(0.2)+2(0.0588)+4(0.0270)+2(0.0154)+4(0.0099)+0.0069]
=2/3[1+0.8+0.1176+0.108+0.0308+0.0396+0.0069]
=2/3×2.1029
≈1.4019
Trapezoidal Rule
Formula: ∫ab f(x) dx ≈h/2[f(x0) + 2f(x1) + 2f(x2) +⋯+ 2f(xn−1) + f(xn)]
Using same n = 6, h = 2
I ≈ 2/2[f0 + 2f1 + 2f2 + 2f3 + 2f4 + 2f5 + f6]
=1 × [1 + 2(0.2 + 0.0588 + 0.0270 + 0.0154 + 0.0099) + 0.0069]
=1 × [1 + 2(0.3111) + 0.0069]
=1+ 0.6222 + 0.0069
=1.6291
Ans.6: We are to solve the differential equation using Euler’s Method:
Given:
Differential equation:
Initial condition:
y(0) = 0
Step size: h= 0.1
Find y at x= 0.2
Euler’s Method Formula:
yn + 1= yn + h⋅f(xn,yn)
Where:
f(x,y) = 1− y
Initial values
x0 = 0, y0 = 0
Step 1: From x = 0 to x = 0.1
f(x0,y0) = 1− y0
= 1−0
=1
y1 = y0 + h⋅f(x0,y0)
= 0 + 0.1⋅1
= 0.1
x1 = 0 + 0.1 = 0.1
Step 2: From x = 0.1 to x = 0.2
f(x1,y1)
= 1 – y1
=1−0.1
=0.9
Page 6 of 7
y2 = y1 + h⋅f(x1,y1)
= 0.1+0.1⋅0.9
= 0.1+0.09
= 0.19
Final Answer: y(0.2) ≈ 0.19
Page 7 of 7