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: R = PolynomialRing(QQ, ’x12,x13,x14,x23,x24,x34’)<br />

sage: x12, x13, x14, x23, x24, x34 = R.gens()<br />

sage: A = matrix(R, [[ 0, x12, x13, x14],<br />

....: [-x12, 0, x23, x24],<br />

....: [-x13, -x23, 0, x34],<br />

....: [-x14, -x24, -x34, 0]])<br />

sage: A.pfaffian()<br />

x14*x23 - x13*x24 + x12*x34<br />

sage: parent(A.pfaffian())<br />

Multivariate Polynomial Ring in x12, x13, x14, x23, x24, x34 over Rational Field<br />

The Pfaffian <strong>of</strong> an alternating matrix squares to its determinant:<br />

sage: A = [[0] * 6 for i in range(6)]<br />

sage: for i in range(6):<br />

....: for j in range(i):<br />

....: u = floor(r<strong>and</strong>om() * 10)<br />

....: A[i][j] = u<br />

....: A[j][i] = -u<br />

....: A[i][i] = 0<br />

sage: AA = Matrix(ZZ, A)<br />

sage: AA.pfaffian() ** 2 == AA.det()<br />

True<br />

AUTHORS:<br />

•Darij Grinberg (1 Oct 2013): first (slow) implementation.<br />

pivot_rows()<br />

Return the pivot row positions for this matrix, which are a topmost subset <strong>of</strong> the rows that span the row<br />

space <strong>and</strong> are linearly independent.<br />

OUTPUT: a tuple <strong>of</strong> integers<br />

EXAMPLES:<br />

sage: A = matrix(QQ,3,3, [0,0,0,1,2,3,2,4,6]); A<br />

[0 0 0]<br />

[1 2 3]<br />

[2 4 6]<br />

sage: A.pivot_rows()<br />

(1,)<br />

sage: A.pivot_rows() # testing cached value<br />

(1,)<br />

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

A plot <strong>of</strong> this matrix.<br />

Each (ith, jth) matrix element is given a different color value depending on its relative size compared to<br />

the other elements in the matrix.<br />

The tick marks drawn on the frame axes denote the (ith, jth) element <strong>of</strong> the matrix.<br />

This method just calls matrix_plot. *args <strong>and</strong> **kwds are passed to matrix_plot.<br />

EXAMPLES:<br />

A matrix over ZZ colored with different grey levels:<br />

sage: A = matrix([[1,3,5,1],[2,4,5,6],[1,3,5,7]])<br />

sage: A.plot()<br />

222 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!