Next: Matrix commands, Previous: Generating Matrices, Up: Matrices and Tensors [Contents][Index]
The rank of matrix is the maximal number of linearly independent columns of matrix, which is always equalt to the maximal number of linearly independent rows of matrix.
e13 : rank([[0,0],[0,0]]); e13: 0 e14 : rank([[0,0],[0,1]]); e14: 1 e15 : rank([[2,0],[0,1]]); e15: 2 e17 : rank([[b,c],[0,a]]); e17: 2 e18 : rank([[b,c,d],[a,0,a],[e,f,a]]); e18: 3
The command row
returns the ith row of the matrix
matrix, where i = int
. If int is larger than
the number of rows of matrix, then Jacal prints an error message.
The corresponding command for columns of a matrix is col
.
e3 : u:[[1, 2, 3], [1, 5, 3]]; [1 2 3] e3: [ ] [1 5 3] e4 : row(u, 2); e4: [1, 5, 3]
The command col
is used to extract a column of a matrix. Here,
matrix is a matrix and integer is a positive integer. If
that integer exceeds the number of columns, an error message such
as
ERROR: list-ref: Wrong type in arg1 ()
appears. Here is an example of correct use of the command
col
:
e19 : a:[[1,2,4],[2,5,6]]; [1 2 4] e19: [ ] [2 5 6] e20 : col(a,2); [2] e20: [ ] [5]
The command minor
returns the submatrix of matrix
obtained by deleting the ith row and the jth column.
e21 : b:[[1,2,3],[3,1,5],[5,2,7]]; [1 2 3] [ ] e21: [3 1 5] [ ] [5 2 7] e22 : minor(b,3,1); [2 3] e22: [ ] [1 5]
The command cofactor
returns the determinant of the i,
j minor
of matrix.
The function rapply
is used to access elements of bunches. It
can also access elements nested at lower levels in a bunch. In
particular, it can also access matrix elements. In the above syntax,
bunch is the bunch whose parts one wishes to access, and n,
int_1, int_2, …, int_n are positive integers.
It returns the int_n-th element of the int_{n-1}-th element
of … of the int_2-th element of the int_1-th element
of bunch. One can have n = 0
. In that case, rapply
simply returns the bunch.
e2 : rapply([[1,2,3],[1,4,6],3],2,3); e2: 6 e6 : rapply([a,b],2); e6: b e7 : rapply([a,b]); e7: [a, b]
Next: Matrix commands, Previous: Generating Matrices, Up: Matrices and Tensors [Contents][Index]