08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

frobenius(flag=0, var=’x’)<br />

Return the Frobenius form (rational canonical form) <strong>of</strong> this matrix.<br />

INPUT:<br />

•flag – 0 (default), 1 or 2 as follows:<br />

–0 – (default) return the Frobenius form <strong>of</strong> this matrix.<br />

–1 – return only the elementary divisor polynomials, as polynomials in var.<br />

–2 – return a two-components vector [F,B] where F is the Frobenius form <strong>and</strong> B is the basis change<br />

so that M = B −1 F B.<br />

•var – a string (default: ‘x’)<br />

ALGORITHM: uses PARI’s matfrobenius()<br />

EXAMPLES:<br />

sage: A = MatrixSpace(ZZ, 3)(range(9))<br />

sage: A.frobenius(0)<br />

[ 0 0 0]<br />

[ 1 0 18]<br />

[ 0 1 12]<br />

sage: A.frobenius(1)<br />

[x^3 - 12*x^2 - 18*x]<br />

sage: A.frobenius(1, var=’y’)<br />

[y^3 - 12*y^2 - 18*y]<br />

sage: F, B = A.frobenius(2)<br />

sage: A == B^(-1)*F*B<br />

True<br />

sage: a=matrix([])<br />

sage: a.frobenius(2)<br />

([], [])<br />

sage: a.frobenius(0)<br />

[]<br />

sage: a.frobenius(1)<br />

[]<br />

sage: B = r<strong>and</strong>om_matrix(ZZ,2,3)<br />

sage: B.frobenius()<br />

Traceback (most recent call last):<br />

...<br />

ArithmeticError: frobenius matrix <strong>of</strong> non-square matrix not defined.<br />

AUTHORS:<br />

•Martin Albrect (2006-04-02)<br />

TODO: - move this to work for more general matrices than just over Z. This will require fixing how PARI<br />

polynomials are coerced to <strong>Sage</strong> polynomials.<br />

gcd()<br />

Return the gcd <strong>of</strong> all entries <strong>of</strong> self; very fast.<br />

EXAMPLES:<br />

sage: a = matrix(ZZ,2, [6,15,-6,150])<br />

sage: a.gcd()<br />

3<br />

height()<br />

Return the height <strong>of</strong> this matrix, i.e., the max absolute value <strong>of</strong> the entries <strong>of</strong> the matrix.<br />

325

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!