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

[ 0 0 1 0 -1 -2 -3]<br />

[ 0 0 0 1 0 1 1]<br />

sage: A*K.basis_matrix().transpose() == zero_matrix(QQ, 4, 4)<br />

True<br />

The default is basis vectors that form a matrix in echelon form. A “pivot basis” instead has a basis matrix<br />

where the columns <strong>of</strong> an identity matrix are in the locations <strong>of</strong> the non-pivot columns <strong>of</strong> the original matrix.<br />

This alternate format is available whenever the base ring is a field.<br />

sage: A = matrix(QQ, [[0, 0, 1, 2, 2, -5, 3],<br />

... [-1, 5, 2, 2, 1, -7, 5],<br />

... [0, 0, -2, -3, -3, 8, -5],<br />

... [-1, 5, 0, -1, -2, 1, 0]])<br />

sage: A.rref()<br />

[ 1 -5 0 0 1 1 -1]<br />

[ 0 0 1 0 0 -1 1]<br />

[ 0 0 0 1 1 -2 1]<br />

[ 0 0 0 0 0 0 0]<br />

sage: A.nonpivots()<br />

(1, 4, 5, 6)<br />

sage: K = A.right_kernel(basis=’pivot’); K<br />

Vector space <strong>of</strong> degree 7 <strong>and</strong> dimension 4 over Rational Field<br />

User basis matrix:<br />

[ 5 1 0 0 0 0 0]<br />

[-1 0 0 -1 1 0 0]<br />

[-1 0 1 2 0 1 0]<br />

[ 1 0 -1 -1 0 0 1]<br />

sage: A*K.basis_matrix().transpose() == zero_matrix(QQ, 4, 4)<br />

True<br />

<strong>Matrices</strong> may have any field as a base ring. Number fields are computed by PARI library code, matrices<br />

over GF (2) are computed by the M4RI library, <strong>and</strong> matrices over the rationals are computed by the IML<br />

library. For any <strong>of</strong> these specialized cases, general-purpose code can be called instead with the keyword<br />

setting algorithm=’generic’.<br />

Over an arbitrary field, with two basis formats. Same vector space, different bases.<br />

sage: F. = FiniteField(5^2)<br />

sage: A = matrix(F, 3, 4, [[ 1, a, 1+a, a^3+a^5],<br />

... [ a, a^4, a+a^4, a^4+a^8],<br />

... [a^2, a^6, a^2+a^6, a^5+a^10]])<br />

sage: K = A.right_kernel(); K<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 2 over Finite Field in a <strong>of</strong> size 5^2<br />

Basis matrix:<br />

[ 1 0 3*a + 4 2*a + 2]<br />

[ 0 1 2*a 3*a + 3]<br />

sage: A*K.basis_matrix().transpose() == zero_matrix(F, 3, 2)<br />

True<br />

sage: B = copy(A)<br />

sage: P = B.right_kernel(basis = ’pivot’); P<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 2 over Finite Field in a <strong>of</strong> size 5^2<br />

User basis matrix:<br />

[ 4 4 1 0]<br />

[ a + 2 3*a + 3 0 1]<br />

sage: B*P.basis_matrix().transpose() == zero_matrix(F, 3, 2)<br />

True<br />

sage: K == P<br />

True<br />

237

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

Saved successfully!

Ooh no, something went wrong!