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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

EXAMPLES:<br />

sage: A = M([1,2,3,4,5,6,7, 22,3/4,34,11,7,5,3, 99,65,1/2,2/3,3/5,4/5,5/6, 9,8/9, 9/8,7/6,6/<br />

sage: M = MatrixSpace(QQ,6,7)<br />

sage: A<br />

[ 1 2 3 4 5 6 7]<br />

[ 22 3/4 34 11 7 5 3]<br />

[ 99 65 1/2 2/3 3/5 4/5 5/6]<br />

[ 9 8/9 9/8 7/6 6/7 76 4]<br />

[ 0 9 8 7 6 5 4]<br />

[ 123 99 91 28 6 1024 1]<br />

sage: A.ncols()<br />

7<br />

sage: A.nrows()<br />

6<br />

AUTHORS:<br />

•Naqi Jaffery (2006-01-24): examples<br />

pivots()<br />

Return the pivot column positions <strong>of</strong> this matrix.<br />

OUTPUT: a tuple <strong>of</strong> Python integers: the position <strong>of</strong> the first nonzero entry in each row <strong>of</strong> the echelon<br />

form.<br />

This returns a tuple so it is immutable; see #10752.<br />

EXAMPLES:<br />

sage: A = matrix(QQ, 2, 2, range(4))<br />

sage: A.pivots()<br />

(0, 1)<br />

rank()<br />

TESTS:<br />

We should be able to compute the rank <strong>of</strong> a matrix whose entries are polynomials over a finite field (trac<br />

#5014):<br />

sage: P. = PolynomialRing(GF(17))<br />

sage: m = matrix(P, [ [ 6*x^2 + 8*x + 12, 10*x^2 + 4*x + 11],<br />

... [8*x^2 + 12*x + 15, 8*x^2 + 9*x + 16] ])<br />

sage: m.rank()<br />

2<br />

rescale_col(i, s, start_row=0)<br />

Replace i-th col <strong>of</strong> self by s times i-th col <strong>of</strong> self.<br />

INPUT:<br />

•i - ith column<br />

•s - scalar<br />

•start_row - only rescale entries at this row <strong>and</strong> lower<br />

EXAMPLES: We rescale the last column <strong>of</strong> a matrix over the rational numbers:<br />

sage: a = matrix(QQ,2,3,range(6)); a<br />

[0 1 2]<br />

[3 4 5]<br />

sage: a.rescale_col(2,1/2); a<br />

[ 0 1 1]<br />

86 Chapter 5. Base class for matrices, part 0

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

Saved successfully!

Ooh no, something went wrong!