F.Y.B.cs Lab Course on 24CsMatU2201
F.Y.B.cs Lab Course on 24CsMatU2201
Shivajinagar, Pune - 5
Mathematics Department
INTRODUCTION
Scilab is a high level free open source software package for scientific computing. It is an enjoyable way to solve problems
numerically. It has a number of general purpose and specialized functions for numerical computation. The computational
problems can be solved much more quickly using Scilab than with the standard programming languages such as C, java,
ETC. Scilab is one of the alternatives to commercial packages for dynamical system modeling simulation packages such
as MATLAB / simulink / MATRIX X / system build etc. Scilab has strong Toolboxes. The Toolboxes contain functions
that are used in the areas such as simulation, optimization, system and control, signal processing etc. Scilab is widely used
in Universities and engineering schools. It is also gaining ground in industrial environments. Scilab is continuously being
Scilab includes a full users manual. One can go through it by clicking Help Browser Menu at consol. Scilab is available
on main platforms like Unix/Linux workstations and windows. It is easy to general some results , draw graphs and then
explore the problem further using Scilab. By minimizing human time, it is particularly used in the initial investigation of
real problems. In Scilab algorithms are available for the numerical solution of differential equations, optimization problems,
interpolation and quadrature. Scilab also provides two and three dimensional graphs which can be readily incorporated
into reports and publications. So because of all this attributes Scilab can be used as a basic package for computational
purposes. In fact, simple user interfaces can be built using Scilab. So the best way to use this booklet is to sit down at
the computer and type in commands as they are described. Look at Scilabs response and check the answers as what you
expect.
Starting Scilab: One can download the latest version of Scilab from the site: http://www.scilab.org. After downloading
Scilab, by double clicking the icon of Scilab start. Scilab provides an environment which uses matrices as its basic data
type. Following is the list of basic commands in Linear Algebra and Numerical Analysis:
1
4. inv(A): gives inverse of a matrix A.
11. rref (A) : displays the reduced row echelon form of matrix A.
14. [P, D] = spec(A) : displays eigenvalues (D) and eigenvectors (P) of a matrix A
15. [L, U ]= lu(A) produces two matrices L and U such that A = L ∗ U with U upper triangular and L a general matrix
2
26. General commands:
clean : cleans the matrix entries which are (approximately) very near to zero.
28. poly([a],’variablename’,’flag’) : defines a polynomial with row matrix [a] whose elements are coefficients or roots of
polynomial.
c) poly(A,’name’) : displays characteristic polynomial of matrix A.name is the variable of the polynomial.
disp(’ ’) : To display.
3
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
2. Compute
A2 , B 2 , AB,
BA
1 6 0 1 0 −2
A= 3 7 2 ,B = 0
4 3
9 −5 1 0 0 1
3. Generate random matrix, zero matrix, matrix with all entries 1, random matrix with integer entries between 0 to 9
of order 2 × 3, 4 × 3
5. Declare
the following matrices
−2 1 8 0 3 0
A= 3 0 2 ,B = −5
1 1
4 −6 3 7 6 2
(b) 7B − 3A
(c) trace of (A − B)
(d) diagonal of A ∗ B
(e) (AB)T
(a) 5x2 + 2x − 3
√
(b) 2 + 3x − x2
4
√ √
(d) Whose roots are 1 + i 2, 1 − i 2
1 1
(e) Whose roots are , , −1
2 3
(a) 2x2 − 2x + 3
1 3
(b) x + x2 − 1
2
(a) y = e2x + x5
(a) f (x) = x4 + 3x − 5
(b) Z = x3 + y 2
(c) Z = sin(x2 + y 2 )
= x, 0≤x≤2
= x − 5, x < 0
5
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
1. Let A = {1, 2, 3, 4}. Determine whether the relation is reflexive, symmetric or transitive
(a) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4)}
(b) R = {(1, 3), (1, 1), (3, 1), (1, 2), (3, 3), (4, 4)}
(c) R = φ
(d) R = {(1, 2), (1, 3), (3, 1), (1, 1), (3, 3), (3, 2), (1, 4), (4, 2), (3, 4)}
0 1 0 1
1 0 1 1
(e) MR =
0 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
(f) MR =
0 0 1 0
0 0 0 1
6
4. Determine whether the relation R on the set A is an equivalence relation.
(a) A = {1, 2, 3, 4, 5}, R = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (3, 1), (2, 3), (3, 3), (4, 4), (3, 2), (5, 5)}
(b) Let A be the set of all straight lines in a plane. Let R be a relation defined on A such that for L1 , L2 ∈ A,
5. Let R be a relation on Z defined as 0 xRy if and only if 6x + 7y is divisible by 13’. Show that R is an equivalence
relation on Z.
6. Let A be the set of points in the plane. Let R be the relation on A such that (a, b) R (a1 , b1 ) if and only if
a2 + b2 = a21 + b21 . Show that R is an equivalence relation on A and describe equivalence classes geometrically.
7
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
1. Using Warshall’s algorithm, obtain transitive closure of relation R = {(1, 2), (2, 2), (2, 4), (3, 2), (3, 4), (4, 1)} on the
2. Let A = {a, b, c, d} be any set and R be a relation defined on A as, R = {(a, a), (a, c), (b, a), (b, b), (c, b), (c, c), (d, d), (d, c)}.
3. Let A = {1, 2, 3, 4, 5} and R = {(1, 1), (1, 4), (2, 2), (3, 4), (3, 5), (4, 1), (5, 2), (5, 5)} be a relation on A. Find transitive
4. The diagraph of a relation R on {a, b, c, d} is given below. Find the transitive closure of R.
a b
d c
5. Let A = {1, 2, 3, 4}. For the relation R whose matrix is given, find the matrix of the transitive closure by using
Warshall’s
algorithm.
1 0 0 1
0 1 1 0
MR =
0 1 1 0
1 0 0 1
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
(b) {(0, 0), (1, 1), (2, 0), (2, 2), (2, 3), (3, 2), (3, 3)}
(c) {(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 2), (3, 3)}
3. Let X any set and A = P (X), a power set of X. For a, b ∈ A define a relation R as follows: aRb if and only if a ⊆ b.
+
4. Let A = Z . For a, b ∈ A define a relation R as follows: aRb if and only if a|b. Show that R is a partial ordering on
A.
9
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
Practical 6,7
a b c
2. Evaluate the determinant, given that d e f = −6
g h i
d e f
(a) a b c
g h i
a b c
(b) d e f
−a −b −c
(c) 2d 2e 2f
5g 5h 5i
3g 3h 3i
(d) 2a + d 2b + e 2c + f
d e f
10
3. Evaluate the determinant of the following matrices by cofactor expansion method
−2 0 5
(a) A =
3 −4 2
1 0 7
3 1 0
(b) B =
−2 −4 3
5 4 −2
−1 −1 −1 −1
0 2 −2 −2
(c) C =
0 0 7 −3
0 0 0 −4
2 2 1 0
−1 0 3 0
(d) D =
4 9 3 1
0 −1 5 7
4. Decide whether the given matrix is invertible, and if so, use the adjoint method to find its inverse
−2 4 3
(a) A =
1 2 0
2 −1 −2
2 0 −3
(b) A = 0 −3 2
−1 0 2
11
6. Use Cramer’s rule to solve
4x1 − x2 = −5
(b) x1 + + 2x3 = 6
− x1 − 2x2 + 3x3 = 8
(c) x + 2y − 3z = −4
4x − y + 2z = 8
2x + 2y − 3z = −3
12
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
Practical 8,9
(a) x + y + 2z = 9
2x + 4y − 3z = 1
3x + 6y − 5z = 0
(b) x − y + 2z = 5
2x − 2y + 4z = 10
3x − 3y + 6z = 15
2x1 − x2 + 4x3 = 1
x1 − x2 + x3 = 3
8x1 + x2 + 4x3 = 11
13
(e) 3x − y + z + 7w = 13
−2x + y − z − 3w = −9
−2x + y − 7w = −8
(f) − 2y + 3x = 3
3x + 6y − 3z = −2
6x + 6y + 3z = 4
(g) 2x + y + 4z = 0
3x + y + 6z = 0
4x + y + 9z = 0
(h) v − 2w + 2x = 0
2u − v + 4w − 3x = 0
4u − v + 6w − 4x = 0
−2u + 2v − 6w + 5x = 0
3. Determine the values of λ for which the system has no solutions, exactly one solution, or infinitely many solutions.
(a) x + 2y + z = 2
2x − 2y + 3z = 1
x + 2y − λz = λ
(b) x + 2y + z = 2
2x − 2y + 3z = 1
x + 2y − (λ2 − 3)z = λ
14
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
Practical 10,11
15
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
16
Practical 13: By Appling Scilab commands solve practical 12
17
Progressive Education Society’s
Shivajinagar, Pune - 5
Mathematics Department
1. Find the characteristic equations, eigenvalues and eigenvector of the following matrices:
2 −1
(a)
10 −9
5 1 3
(b)
0 −1 0
0 1 2
0 0 −2
(c) 1 2 1
1 0 3
0 6 12
(d) 0 3 10
0 0 −2
−2 0 1
(e) −6 −2 0
19 5 −4
5 6 2
(f) 0 −1 −8
1 0 −2
18