You are on page 1of 20

1

BCA 3
rd
Semester
BC0043 01

Computer Oriented Numerical Methods

Q1. Explain the following terms in five sentences each
(i) Data error
(ii) Conversion error
(iii) Numerical error
(iv) Round off error
(v) Truncation error
(vi) Significant digits
Solution:

Absolute Errors:
Definition

Absolute error is the numerical difference between its true value of a quantity and its
approximate value. If X is the true quantity and X
a
is its approximate value then the absolute
error E
a
is given by :


Ea = | True Value - Approximate Value | = | X@Xa
Let AX be a number such that | X - Xa s AX, thenAXis an upper limit
on the magnitude of absolute error and is said to measure absolute accuracy.


Relative Errors:
Definition

The relative error is the absolute error divided by the true value of the quantity and this is
denoted by Er


Relative Error E
r
=
Absolute Error
True Value
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
=
E
a
X
ffffffff
Similarlythe quantity
AX
|X|
fffffffffff
t
AX
|X
a
|
ffffffffffffff
measures the relative accurancy.


Percentage Errors:
Definition

The percentage error Ep is given by



2

E
P
=
E
A
X
ffffffff
B100 = E
r
B100


Observation:
1. The relative and percentage errors are independent of the units used while absolute error is
expressed in terms of there units.
2. if number X is rounded to N decimal places, then
AX =
1
2
ffff
B10
@N
, whereAXis the absolute accuracyA



2. Find the real root of the equation x3 4x 9 = 0 using the
Bisection method.

Solution:

Let f x
` a
=x
3
@4x@9
f 1
` a
= 1@4@9 =@12<0
f 2
` a
= 8@8@8 =@9<0
f 3
` a
= 27@12@9 = + 6<0
Since f 2
` a
is negative and f 3
` a
is positive, a root lies between2and 3A
Therefore the first approximationto the root is x
1
=
2 + 3
2
ffffffffffffffffff
= 2.5
Thenf x
1
b c
= f 2.5
` a
=2.5
3
@4B 2.5@9 =@3.375 <0
Hence the root lies between2.5and 3ASince f 2.5
` a
<0and f 3
` a
>0,
we have the second approximationto the root is
x
2
=
x
1
+ 3
2
fffffffffffffffffff
=
2.5 + 3
2
ffffffffffffffffffffffffff
= 2.75




3

Thenf x
2
b c
= f 2.75
` a
= 2.75
` a
3
@4B 2.75 @9 = 0.7969 >0
Therefore conclude that the root lies between2.5 and2.75,
andso the thirdapproximationto the root is
x
3
= 2.5 +
2.75
2
fffffffffffffffff
h
j
i
k
= 2.625
Also f x
3
b c
= f 2.625
` a
=@1.4121 <0ANowsince f x
3
b c
<0
andf x
2
b c
>0, we have that root lies betweenx
2
andx
3
A
Thus the fourthapproximationto the root is



x
4
=
2.75 + 2.625
=
fffffffffffffffffffffffffffffffffffffffffffffffff
2.6875
The procedure is repeatedandthe successive approximationare
x
5
= 2.703125, x
6
= 2.7109375, x
7
= 2.70703125, x
8
= 2.7051etcA
Therefore x =x
8
= 2.7051is the approximate root A





Q3. Find a real root of the equation x3 2x 5 = 0 by the method
of regula-falsi position, correct to three decimal places.


Let f (x) = x
3
2x 5
Then f (1) = 1 2 5 = 6 < 0
f (2) = 8 4 5 = 1 < 0
f (3) = 27 6 5 = 16 > 0
Hence a root lies between 2 and 3.
Take x
1
= 2, x
2
= 3, f (x
1
) = 1, f (x
2
) = 16, in the method of false position, we get
x
3
= x
1
= 2 = = 2 + = 2.0588



4
Now f(x
3
) = f(2.0588) = (2.0588)
3
2 2.0588 5 = 0.3908 < 0.
Since f(2.0588) < 0 we have that root lies between 2.0588 and 3.0.
Replace x
1
by x
3
, and generate the next approximation using the formula,
x
4
= x
3
= 2.0588 = 2.0813.
Repeating this process, the successive approximations are x
5
= 2.0862,
x
6
= 2.0915, x
7
= 2.0934, x
8
= 2.0941, x
9
= 2.0943 etc.
Hence the root x = 2.094 correct to three decimal places.
Observation: The regula-falsi method is intended to produce faster convergence to the
solution. However, it does not always do so. Sometimes, the values of x
new
do not
improve quickly. One reason for the slow convergence can be the departure from the
basic premises on which the false position method is built.


Q4. Find a real root of the transcendental equation
cosx 3x + 1 = 0, correct to four decimal places using the method
of iteration.


Let f(x) = cos x 3x + 1.
Now f(0) = cos 0 0 + 1 = 2 > 0 and f + 1 < 0. Therefore a root lies
between 0 and .
Rewriting the given equation cos x 3x + 1 = 0 as
x = (1 + cos x) = | (x) (i)

| (x) = (1 + cos x) (say)



5
Differentiate with respect to x on both the sides,
|'(x) = and
Since
s 1, we have < 1.
Therefore | |'(x) | < 1 for all x in .
Hence the iteration method can be applied to the equation (i) and we start with x
0
= 0 or any
choice of x in the interval
x
1
= | (x
0
) = (1+ cos 0) = 0.6667
x
2
= | (x
1
) = (1+ cos 0.6667) = 0.5953
x
3
= | (x
2
) = (1+ cos 0.5953) = 0.6093
x
4
= | (x
3
) = (1+ cos 0.6093) = 0.6067
x
5
= | (x
4
) = (1+ cos 0.6067) = 0.6072
x
6
= | (x
5
) = (1+ cos 0.6072) = 0.6071
x
7
= | (x
6
) = (1+ cos 0.6071) = 0.6071
Hence we take the solution as x = 0.6071 correct to 4 decimal place.



6



Q5. Compute the adjoint and the inverse of
(
(
(

=
3 4 1
4 3 1
3 2 1
A .
Solution:
The minors and cofactors of all elements of the matrix A are calculated in the following
table.
Element Minor Cofactor
a
11
= 1
= 9 16 = 7
(1)
1+1
(7) = 7
a
12
= 2
= 3 4 =
1
(-1)
1+2
(1) = 1
a
13
= 3

= 4 3 = 1
(1)
1+3
1 = 1
a
21
=1

= 6 12 = 6
(1)
2+1
(6) = 6
a
22
= 3

= 3 3 = 0
(1)
2+2
0 = 0
A
23
= 4

= 4 2 = 2
(1)
2+3
(2) = 2
A
31
= 1

= 8 9 = 1
(1)
3+1
(1) = 1
A
32
= 4

= 4 3 = 1
(1)
3+2
1 = 1
a
33
= 3

= 3 2 = 1
(1)
3+3
1 = 1.



7
The adjoint of a square matrix is the transpose of the matrix obtained by replacing each
element of A by its co-factor in A.
Adj A =
= and
det A =

= = 7 + 2 + 3 = 2. Therefore,
A
-1
is, A
1
=
= .
Observations: i) Inverse of a matrix is unique.
ii) (AB)
1
= B
1
A
1

iii) AA
1
= A
1
A = I .










8
Q6. Find the rank of using elementary row
transformation.
The rank of A min {3, 4} = 3.
A = [Firstly we use the leading entry in the first row 1 to make the leading
entries in second and third rows to zero].
Perform,
Perform,
Perform,
The above matrix is in the echelon form having two non-zero rows. Hence the rank of A
is 2.



















9
ASHOK KUMAR
Roll No: 521032228
BCA 3
rd
Semester
BC0043 02

Computer Oriented Numerical Methods


Q1. Investigate the values of l and m such that the system of
equations
x + y + z = 6
x + 2y + 3z = 10
x + 2y + lz = m, may have
(i) Unique solution
(ii) Infinite number of solutions
(iii) No solution.
Solution:
=
Perform,
=

Perform,



10
=
(i) Unique solution: For unique solution, we must have rank A = rank = 3. The
rank (A) will be 3 if (l 3) 0, since the other two entries in the last row are zero.
If (l -3) 0 or l
3 irrespective of the values of m, rank will also be 3. Therefore the system will
have unique solution if l
3.
(ii) Infinite solutions: The number of unknown n = 3, we need rank (A) = rank =
r < 3. Since first row and second row are non zero, we have that r = 2.
Therefore rank (A) = rank
= 2 only when the last row of is completely zero. This is possible if l 3 =
0, m -10 = 0.
Therefore the system will have infinite solutions if l = 3 and m = 10.
(iii) No solution: In this case, we must have rank (A) rank , by case (i) rank(A)
= 3 if l
3 and hence if l = 3 we obtain rank (A) = 2. If we impose (m 10) 0 other than
will be 3.
Therefore the system has no solution if l = 3 and m
10.



Q2. Apply Gauss-Seidel iteration method to solve the equations
18 20 3
3 2 1
= + x x x
25 20 3 2
3 2 1
= + x x x
17 2 20
3 2 1
= + x x x

Solution:



11

We write the equation in the form ( after partial pivoting),

17 2 20
3 2 1
= + x x x
18 20 3
3 2 1
= + x x x
17 2 20
3 2 1
= + x x x

And x
1
=
1
20
fffffffff
17@x
2
+ 2x
3
B C
(i)

x
2
=
1
20
fffffffff
@18@3x
1
+ x
3
B C
(ii)

x
3
=
1
20
fffffffff
25@2x
1
+ 3x
2
B C
(iii)

Initial approximation: x
1
= x
1
0
` a
= 0, x
2
= x
2
0
` a
= 0, x
3
= x
3
0
` a
= 0A

First Iteration:


Taking x
2
= x
2
0
` a
= 0, x
3
0
` a
= 0 in i
` a
,
we get x
1
0
` a
= 0.85
Taking x
1
= x
1
1
` a
= 0.85, x
3
0
` a
= 0 in ii
` a
,
we have x
2
1
` a
=
1
20
fffffffff
@18@3B 0.85 + 0
@ A
= @1.0275

Taking x
1
= x
1
1
` a
=0.85, x
2
= x
2
1
` a
=@1.0275in iii
b c
,

we obtain x
3
1
` a
=
1
20
fffffffff
25@2B0.85 + 3B @1.0275
` a
B C
= 1.0109A

Second Iteration

x
1
2
` a
=
1
20
fffffffff
17@3 @1.0275
` a
+ 2B1.0109
B C
= 1.0025






12

x
2
2
` a
=
1
20
fffffffff
@18@3B @1.0025
` a
+ 1.0109
B C
=@0.9998
x
3
2
` a
=
1
20
fffffffff
25@2B1.0025 + 3B @0.9998
` a
B C
= 0.9998



Similarlyinthirditeration, we get x
1
3
` a
= 1.0000, x
2
3
` a
=@1.0000
x
3
3
` a
= 1.0000


The values in the 2
nd
and 3
rd
iterations being practically the same, we can stop the
iterations. Hence the solution is x
1
= 1, x
2
=@1, x
3
= 1



Q3. Find all eigen values and the corresponding eigen vectors of
the matrix
A =
The characteristic equation of A is = 0 where lI = .
That is, = 0.
Expanding we get
(8 l) [(7l) (3l) 16] + 6 [6 (3l) + 8] + 2 [24 2 (7l) ] = 0
l
3
+ 18 l
2
45 l = 0
That is, l
3
18 l
2
+ 45l = 0 on simplification.

l (l 3) (l 15) = 0



13
Therefore l = 0, 3, 15 are the eigen values of A.
If x, y, z be the components of an eigen vector corresponding to the eigen value l, then
we have
(A l I) X = .
That is, (8 l) x 6y + 2z = 0
6x + (7l)y 4z = 0
2x 4y + (3 l)z = 0
Case I: Let l = 0 we have
8x 6y + 2z = 0 (i)
6x + 7y 4z = 0 (ii)
2x 4y + 3z = 0 (iii)
Applying the rule of cross multiplication for (i) and (ii)
=


Therefore (x, y, z) are proportional to (1, 2, 2) and we can write x = 1k,
y = 2k, z = 2k where k ( 0) is an arbitrary constant. However it is enough
to keep the values of (x, y, z) in the simplest form x = 1, y = 2, z = 2
(putting k = 1). These values satisfy all the equations simultaneously.
Thus the eigen vector X
1
corresponding to the eigen value l = 0 is .



14
Case II: Let l = 3 and the corresponding equations are
5x 6y + 2z = 0 (iv)
6x + 4y 4z = 0 (v)
2x 4y 1z = 0 (vi)
From (iv) and (v) we have

That is,
That is,
Thus X
2
= is the eigen vector corresponding to l = 3.
Case III: Let l = 15 and the associated equations are
7x 6y + 2z = 0 (vii)
6x 8y 4z = 0 (viii)
2x 4y 12z = 0 (ix)
From (vii) and (viii) we have

That is,



15
Thus X
3
= is the eigen vector corresponding to l = 15.
Therefore l = 0, 3, 15 are the eigen values of A and are the
corresponding eigen vectors.




Q4. Use the method of group averages and find a curve of the
form y = mx
n
, that fits the following data:
X 10 20 30 40 50 60 70 80
Y 1.06 1.33 1.52 1.68 1.81 1.91 2.01 2.11
Solution: The required curve is of the form y = mx
n

Taking logarithm on both sides, we get
log
10
y = log
10
m

+ n log
10
x
Let log
10
y = Y, log
10
m = c and log
10
x = X, then the equation becomes
Y = nX +c.
Now e take logarithms of the given pairs of data and divide them into two groups, such
that the first group contains the first four values and the remaining constitutes the
second group, as follows.
Group-I
x y Y = log
10
y X = log
10
x
10 1.06 0.0253 1.0000
20 1.33 0.1239 1.3010
30 1.52 0.1818 1.4771
40 1.68 0.2253 1.6021
SY = 0.5563 SX = 5.3802



16
Group-II
x y Y = log
10
y X = log
10
x
50 1.81 0.2577 1.6990
60 1.91 0.2810 1.7782
70 2.01 0.3032 1.8451
80 2.11 0.3243 1.9031
SY = 1.1662 SX = 7.2254
Using the method of group averages, we determine the constants n and c from (5) and
(6) as follows.


Substituting the values from the above tables, we get
and
4c + 5.3802n 0.5563 = 0 and
4c + 7.2254n- 1.1662 = 0.
Solving we get c = -0.3055 and n = 0.3305.
Therefore m = antilog c = 0.4949.
Hence the required curve is y = (0.4949)x
0.3305
.




Q5. Evaluate f(15), given the following table of values:
x 10 20 30 40 50
y = f(x) 46 66 81 93 101



17
Solution: The value x = 15 is near to the beginning of the table. We use Newtons
forward difference interpolation formula.

Now we put D
4
y = 0, we have 124 4a = 0. This implies that a = 31.
Using Newton forward difference formula
y(x) = y
0
+ pDy
0
+ + where x = x
0
+ ph.
Here h = 1, x
0
= 10, y
0
= 46, Dy
0
= 20, D
2
y
0
= -5,

D
3
y
0
= 2, D
4
y
0
= -3. Therefore p = .
Therefore
f(15) = 46 +(0.5)(20) + + + = 56.
8672.



Q6. Given that
x 1.0 1.1 1.2 1.3 1.4 1.5 1.6
y 7.989 8.403 8.781 9.129 9.451 9.750 10.031



18
Find and at (a) x = 1.1 (b) x = 1.6 using Newtons forward
difference formulae.
The difference table is,
x y D D
2
D
3
D
4
D
5
D
6

1.0
1.1
1.2
1.3
1.4
1.5
1.6
7.989
8.8403
8.781
9.129
9.451
9.750
10.031
0.414
0.378
0.348
0.322
0.299
0.281
-0.036
-0.030
-0.026
-0.023
-0.018
0.006
0.004
0.003
0.005
-0.002
-.0001
0.002
0.001
0.003
0.002
To find and at x = 1.1, we use Newton's Forward differentiation formula, we have


Here h = 0.1, x
0
= 1.0, x
1
= 1.1. The above formula can be rewritten as
(i)
(ii)
Substituting Dy
1
= 0.378, D
2
y
1
= 0.030, D
3
y
1
= 0.004, D
4
y
1
= 0.001, D
5
y
1
= 0.003 in (i)
and (ii), we get



19

= 3.947
Therefore

Therefore
To find at x = 1.6, we have to use Newton's backward differentiation formula,
that is,
(iii)
and
(iv)
We use the above difference table and backward difference operator
instead of D.
Here h = 0.1, x
n
= x
6
= 1.6 and y
6
= 0.281,
2
y
6
= 0.018,
3
y
6
= 0.005,
4
y
6
= 0.002,

5
y
6
= 0.003,
6
y
6
= 0.002.
Putting these values in (iii) and (iv), by taking n = 6, we get,




20

Therefore
and
.

You might also like