BC0043

SPRING 2015 SCHEME OF EVALUATION
PROGRAM
SEMESTER
SUBJECT CODE &
NAME
CREDIT
BK ID
MAXIMUM MARKS
BCA(REVISED 2007)
3
BC0043-COMPUTER ORIENTED NUMERICAL METHODS
4
B0804
60
Q.No
INTERNAL ASSESMENT QUESTION
Marks
1
Find the smallest root of the equation f(x) = x3 – 6x2 + 11x –
6 = 0, by Ramanujan’s method.
10
Ans:
From the equation we have
1
 11x  6x 2  x 3 
1 
 = b1 + b2x + b3x2 +…
6


Here a1 =
11
1
, a2 = – 1, a3 = , a4 = a5 = … = 0.
6
6
11
121
85
, b3 = a1b2 + a2b1 =
–1=
,
6
36
36
Hence b1 = 1, b2 = a1 =
b4 = a1b3 + a2b2 + a3b1 =
575
3661
, b5 = a1b4 + a2b3 + a3b2 + a4b1 =
,
216
1296
b6 = a1b5 + a2b4 + a3b3 + a4b2 + a5b1 =
22631
.
7776
Therefore,
b1 6
  0.54545 ,
b2 11
b2 66

 0.7764705 ,
b3 85
b3 102

 0.8869565 ,
b4 115
b
b4 3450
3138

 0.9423654 , 5 
 0.9706155 .
b5 3661
b6 3233
Total
Mark
s
10
The smallest root of the given equation is unity and it can be seen that
successive convergence approach is to this root.
2.
Investigate the values of  and  such that the system of equations
x+y+z=6
x + 2y + 3z = 10
x + 2y + z = , may have
(i) Unique solution
(ii) Infinite number of solutions
(iii) No solution.
1 1 1 : 6 
Ans: A B = 1 2 3 : 10 
1 2  :  
Perform, R 2  -R1 + R 2 ,and R3  -R1 + R3
A B =
6 
1 1 1 :
0 1 2 :
4 

0 1   1 :   6
Perform, R3  -R 2 + R3
A B =
:
6 
1 1 1
0 1 2 :
4 

0 1   3 :   10
(i) Unique solution: For unique solution, we must have rank A = rank
A B = 3. The rank (A) will be 3 if ( - 3)  0, since the other
two entries in the last row are zero.
If ( -3)  0 or   3 irrespective of the values of , rank A B
will also be 3. Therefore the system will have unique solution if  
3.
10
10
(ii) Infinite solutions: The number of unknown n = 3, we need rank (A)
= rank A B = r < 3. Since first row and second row are non
zero, we have that r = 2.
Therefore rank (A) = rank A B = 2 only when the last row of
A B is completely zero. This is possible if  - 3 = 0,  -10 = 0.
Therefore the system will have infinite solutions if  = 3 and  =
10.
(iii) No solution: In this case, we must have rank (A)  rank A B ,
by case (i) rank(A) = 3 if   3 and hence if  = 3 we obtain rank
(A) = 2. If we impose ( - 10)  0 other than A B will be 3.
Therefore the system has no solution if  = 3 and   10.
3
Solve the system of equations
10x1 –
10
2x2
–
x3 –
x4 =
–2x1 + 10x2
–
x3 –
x4 = 15
–
2x4 = 27
–x1
–
x2 + 10x3
–x1
–
x2
–
3
2x3 + 10x4 = – 9
by applying (a) Jacobi’s iterative method, (b) Gauss-Seidel iterative
method
Ans: The given system of equations are diagonally dominant and the
equations be put in the form.
x1 =
0.3 + 0.2x2 + 0.1x3 + 0.1x4
x2 =
1.5 + 0.2x1 + 0.1x3 + 0.1x4
x3 =
2.7 + 0.1x1 + 0.1x2 + 0.2x4
x4 = – 0.9 + 0.1x1 + 0.1x2 + 0.2x3
It can be verified that these equations satisfy the condition
4
a ij
j  1
a ii

< 1, (i = 1, 2, 3, 4)
10
Initial approximation:
(0)
(0)
x1 = x1(0)  0, x 2  x(0)
2  0, x3  x3  0, x 4  x 4  0 .
These results are given in the tables below:
Gauss-Jacobi’s method:
Iterations (j)
x1( j  1)
x (2j  1)
x3( j  1)
x (4j  1)
0
0.3000
1.5000
2.7000
– 0.9000
1
0.7800
1.7400
2.7000
– 0.1800
2
0.9000
1.9080
2.9160
– 0.1080
3
0.9624
1.9608
2.9592
– 0.0360
4
0.9845
1.9848
2.9851
– 0.0158
5
0.9939
1.9938
2.9938
– 0.0060
6
0.9975
1.9975
2.9976
– 0.0025
7
0.9990
1.9990
2.9990
– 0.0010
8
0.9996
1.9996
2.9996
– 0.0004
9
0.9998
1.9998
2.9998
– 0.0002
10
0.9999
1.9999
2.9999
– 0.0001
11
1.0000
2.0000
3.0000
0.0000
Gauss – Seidel method
Iteration j
x1( j  1)
x (2j  1)
x3( j  1)
x (4j  1)
0
1
2
3
4
5
6
0.3000
0.8869
0.9836
0.9968
0.9994
0.9999
1.0000
1.5600
1.9523
1.9899
1.9982
1.9997
1.9999
2.0000
2.8860
2.9566
2.9924
2.9987
2.9998
3.0000
3.0000
– 0.1368
– 0.0248
– 0.0042
– 0.0008
– 0.0001
0.0000
0.0000
From the above two tables, it is clear that 12 iterations are required by
Jacobi’s method to achieve the same accuracy as seven Gauss – Seidel
iterations.
Therefore the solutions are x1 = 1, x2 = 2, x3 = 3 and x4 = 0. In both
the methods, we have taken the initial approximations
x
(0)
1
4

 x (0)
 x3(0)  x (0)
 0 .
2
4
Fit a parabola y = a + bx + cx2 by the method least squares for the data.
X
2
4
6
8
10
Y
3.07
12.85
31.47
57.38
91.29
Ans:Let us choose X =
10
x  6 and Y = y – 39
2
36
~ 6 = A (say)
5
y  196.06 ~ 39 = B (say).
5
Since x 
The normal equations for Y = a + bX + cX2 are
 Y = na + b  X + C  X2
 X Y = a  X + b  X2 + C  X3
 X2 Y = a  X2 + b  X3 + C  X4
Here n = 5.
The relevant table is given below:
X
Y
X=
x6
2
Y = y –39
XY
X2Y
X2
X3
X4
2
3.07
–2
–35.93
71.86
–143.72
4
–8
16
4
12.85
–1
–26.15
26.15
–26.15
1
–1
1
6
31.47
0
–7.53
0
0
0
0
0
8
57.83
1
18.38
18.38
18.38
1
1
1
10 91.29
2
52.29
104.58
209.16
4
8
16
X = 0 Y = 1.06 XY=220.97 X2Y=57.67
The normal equations becomes
5 a + 10 c = 1.06
10 b = 220.97
10 a + 34 c = 57.67
X2=10 X3 = 0
X4 = 34
10
Solving these simultaneous, equations, we get,
a = – 7.73, b = 22.097, c = 3.97
The parabola Y = a + bX + cX2 becomes
Y = – 7.73 + 22.097 X + 3.97 X2
or
y – 39 = – 7.73 + 22.09 (
x -6
x -6 2
) + 3.97(
)
2
2
on simplification we obtain
y = 0.7 – 0.86x + 0.9925 x2
5.
Find the maximum and minimum value of y from the following table.
x
0
1
2
3
4
5
y
0
1
4
0
9
4
16
225
4
Ans: Here h =1. Newton’s forward difference formula is
y(x) = (1/h){y0 + py0 +
+
p ( p 1 ) 2
p ( p 1 )( P  2 ) 3
 y0 
 y0
2!
3!
p ( p 1 )( p  2 )( p  3 ) 4
 y0 + . . . } where x = x0 + ph.
4!

dy 1 
( 2 p 1 ) 2
( 3 p 2 6 p  2 ) 3
( 4 p 3 18 p 2  22 p 6 ) 4
  y 0 
 y0 
 y0 
 y 0 ... 
dx h 
2
6
4!


x
y
y
2y
3y
4y
5y
0
1
2
3
4
5
0
0.25
0
2.25
16
56.25
0.25
-0.25
2.25
13.75
40.25
-0.50
2.50
11.50
26.50
3
9
15
6
6
0
Choosing the origin at x0 = 0, p =
x 0
x
1
10
10

dy 1 
( 2 p 1 )
( 3 p 2 6 p  2 )
( 4 p 3 18 p 2  22 p 6 )
  0.25 
( 0.50 ) 
3 
6  .... 
dx 1 
2
6
24


= 4p3-12p2 + 8p.
Now
d2y
dx
2
dy
dx
= 0  4p3-12p2 + 8p = 0  4p(p-2)(p-1) = 0  p = 0, 1, 2.
=12p2-24p+8
At p = 0,
At p = 1,
At p = 2,
d2y
dx 2
d2y
dx 2
d2y
dx 2
8 whish is positive.
-4 whish is negative.
8 whish is positive.
Therefore y is maximum at p = 1 and minimum at p = 0 and p = 2.
The maximum value y at p = 1 (that is., x =1) is
y(1) = 0.25.
6.
Compute y(0.1) and y(0.2) by Runge-Kutta method of fourth order for
the differential equation
dy
 xy + y2, y(0) = 1.
dx
Ans:The formulae for the fourth order Runge-Kutta method are
yi+1 = yi + 1 [K1 + 2K2 + 2K3 + K4], where K1, K2, K3, K4 defined above.
6
Here f(x, y) = xy + y2.
x0 = 0, y0 = y(0) = 1 and h = 0.1 .
x1 = x0 + h = 0.1
x2 = x1 + h = 0.2
To find y1 = y (x1) = y(x1) = y (0.1), put i = 0 in R-K method, we get
y1 = y0 + 1 [K1 + 2K2 + 2K3 + K4]
6
10
10
where K1 = hf(x0, y0) = h(x0 y0 + y02 ) = 0.1 (0 + 12) = 0.1
K2 = h f ( x0 
K
h
, y0  1 ) = h f(0.05, 1.05) = 0.1 ((0.05)(1.05) + (1.05)2)
2
2
= 0.1155.
K3 = h f ( x0 
K
h
, y0  2 ) = h f(0.05, 1.05775)
2
2
=
0.1 ((0.05) (1.5775) + (1.05775)2 ) =
0.1172.
K4 = hf (x0 + h, y0 + K3) = hf(0.1, 1.1172)
= 0.1 ((0.1) (1.1172) + (1.1172)2 ) = 0.1169
we have K1 = 0.1, K2 = 0.1155, K3 = 0.1172, K4 = 0.1169.
Therefore y1 = 1 + 1 [0.1 + 2 (0.1155) + 2 (0.1172) + 0.1169]
6
= 1.1169
Therefore y (0.1) = 1.1169
To find y2 = y (x2) = y(x2) = y (0.2), put i = 1 in R-K method of order
4, we have
y2 = y1 + 1 [K1 + 2K2 + 2K3 + K4], where
6
K1 = h f(x1, y1) = 0.1 f(0.1, 1.1169) = 0.1 (0.1 (1.1169) +(1.1169)2 )=
0.1359
K2 = h f ( x1 
K
h
, y1  1 ) = 0.1 f(0.15, 1.1849)
2
2
= 0.1 (0.15 (1.1849) + (1.1849)2 ) = 0.1582
K3 = h f ( x1 
K
h
, y1  2 ) = 0.1 f(0.15, 1.196) = 0.1(0.15 (1.196) +
2
2
(1.196)2 )
= 0.1610
K4 = hf (x1 + h, y1 + K3) = 0.1 f(0.2, 1.2779) = 0.1 (0.2 (1.2779)+(1.2779)2
)
= 0.1889.
So K1 = 0.1, K2 = 0.1155, K3 = 0.1172, K4 = 0.1169.
Therefore y2 = 1.1169 + 1 [0.1359 + 2 (0.1582) + 2 (0.1610) + 0.1889)]
6
= 1.2774.
Therefore y (0.2) = 1.2774 .