The functions given here apply to matrices defined over Euclidean Domains.
EchelonForm(a) : AlgMatElt -> AlgMatElt, AlgMatElt
The (row) echelon form of matrix a belonging to a submodule of the module M_n(S). This function returns two values:
- The (row) echelon form e of a; and
- A matrix b such that b * a = e, i.e. b is a product of elementary matrices that transforms a into echelon form.
The elementary divisors of the matrix a belonging to a submodule of the module M_n(S). The divisors are returned as a sequence [e_1, ..., e_d], e_i | e_(i + 1) (i=1 , ..., d - 1) of d elements of R, where d is the rank of a.
The row Hermite normal form of an matrix a belonging to a submodule of the module M_n(S), where S is a Euclidean Domain. This function returns two values:
- The Hermite normal form h of a; and
- A matrix b such that b * a = h, i.e. b is the product of elementary matrices that transforms a into Hermite normal form.
The Smith normal form for the matrix a belonging to a submodule of the module M_n(S), where S is a Euclidean Domain. This function returns two values:
- The Smith normal form s of a; and
- Unimodular matrices b and c such that b * a * c = s, i.e. b and c are matrices that transform a into Smith normal form.
> K<w> := FiniteField(8); > M := MatrixAlgebra(K, 4); > A := M ! [1, w, w^5, 0, w^3, w^4, w, 1, w^6, w^3, 1, w^4, 1, w, 1, w ]; > print A; [ 1 w w^5 0] [w^3 w^4 w 1] [w^6 w^3 1 w^4] [ 1 w 1 w] > print EchelonForm(A); [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
The functions in this group apply to elements of matrix algebras whose
coefficient rings are fields. Some functions, such as
CharacteristicPolynomial, also apply to matrices over the integers.
CharacteristicPolynomial(a: parameters) : AlgMatElt -> RngUPolElt
Al: MonStg Default: "Modular"
Proof: BoolElt Default: true
The characteristic polynomial of the element a belonging to the algebra M_n(R), R a domain. The parameter Al may be used to specify the algorithm used. The algorithm Modular (the default) can be used for matrices over Z and Q---in such a case the parameter Proof can also be used to suppress proof of correctness. The algorithm Hessenberg, allowed for matrices over fields, works by first reducing the matrix to Hessenberg form. The algorithm Interpolation, allowed for matrices over Z and Q, works by evaluating the characteristic matrix of a at various points and then interpolating. The algorithm Trace, allowed for matrices over fields, works by calculating the traces of powers of a.
The eigenvalues of the matrix a returned as a set of pairs, each of which gives the value of a distinct eigenvalue and its multiplicity.
The eigenspace of the matrix a, corresponding to the eigenvalue e, returned as a submodule of the base module for the parent algebra of a (i.e. the kernel of a - eI). If the ring element e is not a eigenvalue for the matrix a then the trivial space is returned.
The invariant factors of the matrix a. This is the same as the third return value of RationalForm(a).
True iff a is similar to b. If so, a matrix t is also returned with t * a * t^(-1)=b.
The (generalized) Jordan canonical form for the matrix a belonging to the algebra M_n(K), where K is a field. This function returns three values:
- The Jordan canonical form j of a;
- A non-singular matrix b such that b * a * b^(-1)= j;
- A sequence of pairs corresponding to the blocks of j where each pair consists of the irreducible polynomial and multiplicity making up the block.
The minimal polynomial of the element a belonging to the module M_n(R), where R is a field or Z.
The primary invariant factors of the matrix a. This is the same as the third return value of PrimaryRationalForm(a) or JordanForm(a).
The primary rational canonical form of a matrix a belonging to M_n(K). Each block corresponds to a power of an irreducible polynomial. This function returns three values:
- The primary rational canonical form p of a;
- A non-singular matrix b such that b * a * b^(-1) = p;
- A sequence of pairs corresponding to the blocks of p where each pair consists of the irreducible polynomial and multiplicity making up the block.
The rational canonical form of a matrix a belonging to M_n(K). For each block before the last block, the polynomial corresponding to that block divides the polynomial corresponding to the next block. This function returns three values:
- The rational canonical form f of a;
- A non-singular matrix b such that b * a * b^(-1) = f;
- A sequence containing the polynomials corresponding to each block (each non-last one dividing the next).
> K := GaloisField(5);
> P<x> := PolynomialAlgebra(K);
> M := MatrixAlgebra(P, 5);
> a := M ! [x^i + x^j: i, j in [1..5]];
> print a;
[ 2*x x^2 + x x^3 + x x^4 + x x^5 + x]
[ x^2 + x 2*x^2 x^3 + x^2 x^4 + x^2 x^5 + x^2]
[ x^3 + x x^3 + x^2 2*x^3 x^4 + x^3 x^5 + x^3]
[ x^4 + x x^4 + x^2 x^4 + x^3 2*x^4 x^5 + x^4]
[ x^5 + x x^5 + x^2 x^5 + x^3 x^5 + x^4 2*x^5]
> print ElementaryDivisors(a);
[
x,
x^3 + 3*x^2 + x
]
> K := GF(5);
> P<x> := PolynomialRing(K);
> A := MatrixAlgebra(K, 5);
> a := A !
> [
> 0, 2, 4, 2, 0,
> 2, 2, 2, 3, 3,
> 3, 4, 4, 1, 3,
> 0, 0, 0, 0, 1,
> 0, 0, 0, 1, 0
> ];
> print a;
[0 2 4 2 0]
[2 2 2 3 3]
[3 4 4 1 3]
[0 0 0 0 1]
[0 0 0 1 0]
> print PrimaryInvariantFactors(a);
[
<x + 1, 1>,
<x + 1, 1>,
<x + 4, 1>,
<x + 4, 1>,
<x + 4, 1>
]
> r, t, f := RationalForm(a);
> print r;
[1 0 0 0 0]
[0 0 1 0 0]
[0 1 0 0 0]
[0 0 0 0 1]
[0 0 0 1 0]
> print t;
[1 3 0 2 1]
[2 1 2 2 0]
[3 4 3 4 1]
[1 0 0 0 0]
[0 2 4 2 0]
> print f;
[
x + 4,
x^2 + 4,
x^2 + 4
]
> PA := MatrixAlgebra(P, 5);
> ax := PA ! x - PA ! a;
> print ax;
[ x 3 1 3 0]
[ 3 x + 3 3 2 2]
[ 2 1 x + 1 4 2]
[ 0 0 0 x 4]
[ 0 0 0 4 x]
> print SmithForm(ax);
[ 1 0 0 0 0]
[ 0 1 0 0 0]
[ 0 0 x + 4 0 0]
[ 0 0 0 x^2 + 4 0]
[ 0 0 0 0 x^2 + 4]