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

... [4*a^2 + 3*a + 4, 4*a^2 + 2, 3*a, 2*a^2 + 4*a + 2],<br />

... [ 3*a^2 + a, 3*a, 3*a^2 + 2, 3*a^2 + 2*a + 3],<br />

... [2*a^2 + 2*a + 1, 2*a^2 + 4*a + 2, 3*a^2 + 2*a + 3, 3*a^2 + 2*a + 4]])<br />

sage: A.is_symmetric()<br />

True<br />

sage: L, d = A.indefinite_factorization()<br />

sage: D = diagonal_matrix(d)<br />

sage: L<br />

[ 1 0 0 0]<br />

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

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

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

sage: D<br />

[ a^2 + 2*a 0 0 0]<br />

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

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

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

sage: A == L*D*L.transpose()<br />

True<br />

AUTHOR:<br />

•Rob Beezer (2012-05-24)<br />

integer_kernel(ring=’ZZ’)<br />

Return the kernel <strong>of</strong> this matrix over the given ring (which should be either the base ring, or a PID whose<br />

fraction field is the base ring).<br />

Assume that the base field <strong>of</strong> this matrix has a numerator <strong>and</strong> denominator functions for its elements, e.g.,<br />

it is the rational numbers or a fraction field. This function computes a basis over the integers for the kernel<br />

<strong>of</strong> self.<br />

If the matrix is not coercible into QQ, then the PID itself should be given as a second argument, as in the<br />

third example below.<br />

EXAMPLES:<br />

sage: A = MatrixSpace(QQ, 4)(range(16))<br />

sage: A.integer_kernel()<br />

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

Echelon basis matrix:<br />

[ 1 0 -3 2]<br />

[ 0 1 -2 1]<br />

The integer kernel even makes sense for matrices with fractional entries:<br />

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

sage: A.integer_kernel()<br />

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

Echelon basis matrix:<br />

[0 1]<br />

An example over a bigger ring:<br />

sage: L. = NumberField(x^2 - x + 2)<br />

sage: OL = L.ring_<strong>of</strong>_integers()<br />

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

sage: A.integer_kernel(OL)<br />

Free module <strong>of</strong> degree 2 <strong>and</strong> rank 1 over Maximal Order in Number Field in w with defining pol<br />

Echelon basis matrix:<br />

[ -1 -w + 1]<br />

183

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

Saved successfully!

Ooh no, something went wrong!