5.2 Matrix Parts

Command: rank matrix

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.

(%0077) rank([[0,0],[0,0]]);
%0077: 0
(%0078) rank([[0,0],[0,1]]);
%0078: 1
(%0079) rank([[2,0],[0,1]]);
%0079: 2
(%0080) rank([[b,c],[0,a]]);
%0080: 2
(%0081) rank([[b,c,d],[a,0,a],[e,f,a]]);
%0081: 3
Command: row matrix i

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.

(%0082) U1:[[1, 2, 3], [1, 5, 3]];
    [ 1  2  3 ]
U1: [         ]
    [ 1  5  3 ]
(%0082) row(U1, 2);
%0082: [1, 5, 3]
Command: col matrix integer

The command col is used to extract a column of a matrix. Here, matrix is a matrix and integer is a positive integer. It is an error if that integer exceeds the number of columns.

(%0084) C1:[[1,2,4],[2,5,6]];
    [ 1  2  4 ]
C1: [         ]
    [ 2  5  6 ]
(%0084) col(C1,2);
       [ 2 ]
%0084: [   ]
       [ 5 ]
Command: minor matrix i j

The command minor returns the submatrix of matrix obtained by deleting the ith row and the jth column.

(%0085) M3:[[1,2,3],[3,1,5],[5,2,7]];
    [ 1  2  3 ]
    [         ]
M3: [ 3  1  5 ]
    [         ]
    [ 5  2  7 ]
(%0085) minor(M3,3,1);
       [ 2  3 ]
%0085: [      ]
       [ 1  5 ]
Command: cofactor matrix i j

The command cofactor returns the determinant of the i, j minor of matrix.

Command: rref bunch int_1 int_2 …

The function rref 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, rref simply returns the bunch.

(%0088) [[1,2,3],[1,4,6],3] [2] [3];
%0088: 6
(%0089) [a,b] [2];
%0089: b