REDUCE

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 20.32) and NORMFORM (section 20.37) packages.

14.4.1 DET Operator

Syntax:

det(\(\langle \)exprn:matrix_expression\(\rangle \)) : 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 \[ \left ( \begin {array}{lcr} a & b & c \\ d & e & f \\ g & h & j \end {array} \right ) \]

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(\(\langle \)exprn:matrix_expression,id\(\rangle \)) : \(\langle \)list\(\rangle \) .

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(\(\langle \)exprn:matrix_expression\(\rangle \)) : \(\langle \)matrix\(\rangle \) .

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

14.4.4 Trace Operator

Syntax:

trace(\(\langle \)exprn:matrix_expression\(\rangle \)) : \(\langle \)algebraic\(\rangle \).

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

14.4.5 Matrix Cofactors

Syntax:

cofactor(\(\langle \)exprn:matrix_expression\(\rangle \),\(\langle \)row:integer\(\rangle \),\(\langle \)column:integer\(\rangle \)) : 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(\(\langle \)exprn:matrix_expression\(\rangle \)) : \(\langle \)list\(\rangle \)

nullspace calculates for a matrix \(A\) a list of linear independent vectors (a basis) whose linear combinations satisfy the equation \(A x = 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(\(\langle \)exprn:matrix_expression\(\rangle \)) : \(\langle \)integer\(\rangle \) .

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.


Hosted by Download REDUCE Powered by MathJax