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 />

sage: A = Mat(GF(7),3,3)(range(3)*3)<br />

sage: A.charpoly()<br />

x^3 + 4*x^2<br />

sage: A = Mat(Integers(6),3,3)(range(9))<br />

sage: A.charpoly()<br />

x^3<br />

determinant()<br />

Return the determinant <strong>of</strong> this matrix.<br />

EXAMPLES:<br />

sage: m = matrix(GF(101),5,range(25))<br />

sage: m.det()<br />

0<br />

sage: m = matrix(Integers(4), 2, [2,2,2,2])<br />

sage: m.det()<br />

0<br />

TESTS:<br />

sage: m = r<strong>and</strong>om_matrix(GF(3), 3, 4)<br />

sage: m.determinant()<br />

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

...<br />

ValueError: self must be a square matrix<br />

echelonize(algorithm=’gauss’, **kwds)<br />

Puts self in row echelon form.<br />

INPUT:<br />

•self - a mutable matrix<br />

•algorithm- ’gauss’ - uses a custom slower O(n 3 ) Gauss elimination implemented in <strong>Sage</strong>.<br />

•**kwds - these are all ignored<br />

OUTPUT:<br />

•self is put in reduced row echelon form.<br />

•the rank <strong>of</strong> self is computed <strong>and</strong> cached<br />

•the pivot columns <strong>of</strong> self are computed <strong>and</strong> cached.<br />

•the fact that self is now in echelon form is recorded <strong>and</strong> cached so future calls to echelonize return<br />

immediately.<br />

EXAMPLES:<br />

sage: a = matrix(GF(97),3,4,range(12))<br />

sage: a.echelonize(); a<br />

[ 1 0 96 95]<br />

[ 0 1 2 3]<br />

[ 0 0 0 0]<br />

sage: a.pivots()<br />

(0, 1)<br />

hessenbergize()<br />

Transforms self in place to its Hessenberg form.<br />

295

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

Saved successfully!

Ooh no, something went wrong!