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 = MatrixSpace(IntegerRing(), 2)([1,2,3,4])<br />

sage: A.row_module()<br />

Free module <strong>of</strong> degree 2 <strong>and</strong> rank 2 over Integer Ring<br />

Echelon basis matrix:<br />

[1 0]<br />

[0 2]<br />

row_space(base_ring=None)<br />

Return the row space <strong>of</strong> this matrix. (Synonym for self.row_module().)<br />

EXAMPLES:<br />

sage: t = matrix(QQ, 3, range(9)); t<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: t.row_space()<br />

Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 2 over Rational Field<br />

Basis matrix:<br />

[ 1 0 -1]<br />

[ 0 1 2]<br />

sage: m = Matrix(Integers(5),2,2,[2,2,2,2]);<br />

sage: m.row_space()<br />

Vector space <strong>of</strong> degree 2 <strong>and</strong> dimension 1 over Ring <strong>of</strong> integers modulo 5<br />

Basis matrix:<br />

[1 1]<br />

rref(*args, **kwds)<br />

Return the reduced row echelon form <strong>of</strong> the matrix, considered as a matrix over a field.<br />

If the matrix is over a ring, then an equivalent matrix is constructed over the fraction field, <strong>and</strong> then row<br />

reduced.<br />

All arguments are passed on to :meth:echelon_form.<br />

Note: Because the matrix is viewed as a matrix over a field, every leading coefficient <strong>of</strong> the returned<br />

matrix will be one <strong>and</strong> will be the only nonzero entry in its column.<br />

EXAMPLES:<br />

sage: A=matrix(3,range(9)); A<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: A.rref()<br />

[ 1 0 -1]<br />

[ 0 1 2]<br />

[ 0 0 0]<br />

Note that there is a difference between rref() <strong>and</strong> echelon_form() when the matrix is not over a<br />

field (in this case, the integers instead <strong>of</strong> the rational numbers):<br />

sage: A.base_ring()<br />

Integer Ring<br />

sage: A.echelon_form()<br />

[ 3 0 -3]<br />

[ 0 1 2]<br />

[ 0 0 0]<br />

250 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!