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

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

sage: A.left_kernel()<br />

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

Basis matrix:<br />

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

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

Over a finite field, with a basis matrix in “pivot” format.<br />

sage: A = matrix(FiniteField(7), [[5, 0, 5, 2, 4],<br />

... [1, 3, 2, 3, 6],<br />

... [1, 1, 6, 5, 3],<br />

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

sage: A.kernel(basis=’pivot’)<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 2 over Finite Field <strong>of</strong> size 7<br />

User basis matrix:<br />

[5 2 1 0]<br />

[6 3 0 1]<br />

The left kernel <strong>of</strong> a zero matrix is the entire ambient vector space whose degree equals the number <strong>of</strong> rows<br />

<strong>of</strong> self (i.e. everything).<br />

sage: A = MatrixSpace(QQ, 3, 4)(0)<br />

sage: A.kernel()<br />

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

Basis matrix:<br />

[1 0 0]<br />

[0 1 0]<br />

[0 0 1]<br />

We test matrices with no rows or columns.<br />

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

sage: A.left_kernel()<br />

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

Basis matrix:<br />

[1 0]<br />

[0 1]<br />

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

sage: A.left_kernel()<br />

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

Basis matrix:<br />

[]<br />

The results are cached. Note that requesting a new format for the basis is ignored <strong>and</strong> the cached<br />

copy is returned. Work with a copy if you need a new left kernel, or perhaps investigate the<br />

right_kernel_matrix() method on the transpose, which does not cache its results <strong>and</strong> is more<br />

flexible.<br />

sage: A = matrix(QQ, [[1,1],[2,2]])<br />

sage: K1 = A.left_kernel()<br />

sage: K1<br />

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

Basis matrix:<br />

[ 1 -1/2]<br />

sage: K2 = A.left_kernel()<br />

sage: K1 is K2<br />

True<br />

sage: K3 = A.left_kernel(basis=’pivot’)<br />

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