Up Next Prev PrevTail Tail

### 14.4 Operators with Matrix Arguments

The operator LENGTH applied to a matrix returns a list of the number of rows and columns in the matrix. Other operators useful in matrix calculations are defined in the following subsections. Attention is also drawn to the LINALG (section 16.37) and NORMFORM (section 16.42) packages.

#### 14.4.1 DET Operator

Syntax:

DET(EXPRN:matrix_expression):algebraic.

The operator DET is used to represent the determinant of a square matrix expression. E.g.,

det(y^2)

is a scalar expression whose value is the determinant of the square of the matrix Y, and

det mat((a,b,c),(d,e,f),(g,h,j));

is a scalar expression whose value is the determinant of the matrix

Determinant expressions have the instant evaluation property. In other words, the statement

let det mat((a,b),(c,d)) = 2;

sets the value of the determinant to 2, and does not set up a rule for the determinant itself.

#### 14.4.2 MATEIGEN Operator

Syntax:

MATEIGEN(EXPRN:matrix_expression,ID):list.

MATEIGEN calculates the eigenvalue equation and the corresponding eigenvectors of a matrix, using the variable ID to denote the eigenvalue. A square free decomposition of the characteristic polynomial is carried out. The result is a list of lists of 3 elements, where the first element is a square free factor of the characteristic polynomial, the second its multiplicity and the third the corresponding eigenvector (as an n by 1 matrix). If the square free decomposition was successful, the product of the first elements in the lists is the minimal polynomial. In the case of degeneracy, several eigenvectors can exist for the same eigenvalue, which manifests itself in the appearance of more than one arbitrary variable in the eigenvector. To extract the various parts of the result use the operations defined on lists.

Example: The command

mateigen(mat((2,-1,1),(0,1,1),(-1,1,1)),eta);

gives the output

{{ETA - 1,2,

[ARBCOMPLEX(1)]
[             ]
[ARBCOMPLEX(1)]
[             ]
[      0      ]

},

{ETA - 2,1,

[      0      ]
[             ]
[ARBCOMPLEX(2)]
[             ]
[ARBCOMPLEX(2)]

}}

#### 14.4.3 TP Operator

Syntax:

TP(EXPRN:matrix_expression):matrix.

This operator takes a single matrix argument and returns its transpose.

#### 14.4.4 Trace Operator

Syntax:

TRACE(EXPRN:matrix_expression):algebraic.

The operator TRACE is used to represent the trace of a square matrix.

#### 14.4.5 Matrix Cofactors

Syntax:

COFACTOR(EXPRN:matrix_expression,ROW:integer,COLUMN:integer):
algebraic

The operator COFACTOR returns the cofactor of the element in row ROW and column COLUMN of the matrix MATRIX. Errors occur if ROW or COLUMN do not simplify to integer expressions or if MATRIX is not square.

#### 14.4.6 NULLSPACE Operator

Syntax:

NULLSPACE(EXPRN:matrix_expression):list

NULLSPACE calculates for a matrix A a list of linear independent vectors (a basis) whose linear combinations satisfy the equation Ax = 0. The basis is provided in a form such that as many upper components as possible are isolated.

Note that with b := nullspace a the expression length b is the nullity of A, and that second length a - length b calculates the rank of A. The rank of a matrix expression can also be found more directly by the RANK operator described below.

Example: The command

nullspace mat((1,2,3,4),(5,6,7,8));

gives the output

{
[ 1  ]
[    ]
[ 0  ]
[    ]
[ - 3]
[    ]
[ 2  ]
,
[ 0  ]
[    ]
[ 1  ]
[    ]
[ - 2]
[    ]
[ 1  ]
}

In addition to the REDUCE matrix form, NULLSPACE accepts as input a matrix given as a list of lists, that is interpreted as a row matrix. If that form of input is chosen, the vectors in the result will be represented by lists as well. This additional input syntax facilitates the use of NULLSPACE in applications different from classical linear algebra.

#### 14.4.7 RANK Operator

Syntax:

RANK(EXPRN:matrix_expression):integer

RANK calculates the rank of its argument, that, like NULLSPACE can either be a standard matrix expression, or a list of lists, that can be interpreted either as a row matrix or a set of equations.

Example:

rank mat((a,b,c),(d,e,f));

returns the value 2.

 Up Next Prev PrevTail Front