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

results.<br />

sage: Q = QuadraticField(-7)<br />

sage: a = Q.gen(0)<br />

sage: A = matrix(Q, [[2, 5-a, 15-a, 16+4*a],<br />

... [2+a, a, -7 + 5*a, -3+3*a]])<br />

sage: C = A.right_kernel_matrix(algorithm=’default’, basis=’computed’); C<br />

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

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

sage: A*C.transpose() == zero_matrix(Q, 2, 2)<br />

True<br />

sage: P = A.right_kernel_matrix(algorithm=’pari’, basis=’pivot’); P<br />

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

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

sage: A*P.transpose() == zero_matrix(Q, 2, 2)<br />

True<br />

sage: E = A.right_kernel_matrix(algorithm=’default’, basis=’echelon’); E<br />

[ 1 0 7/88*a + 3/88 -3/176*a - 39/176]<br />

[ 0 1 -1/88*a - 13/88 13/176*a - 7/176]<br />

sage: A*E.transpose() == zero_matrix(Q, 2, 2)<br />

True<br />

We can bypass using PARI for number fields <strong>and</strong> use <strong>Sage</strong>’s general code for matrices over any field. The<br />

basis vectors as computed are in pivot format.<br />

sage: Q = QuadraticField(-7)<br />

sage: a = Q.gen(0)<br />

sage: A = matrix(Q, [[2, 5-a, 15-a, 16+4*a],[2+a, a, -7 + 5*a, -3+3*a]])<br />

sage: G = A.right_kernel_matrix(algorithm=’generic’, basis=’computed’); G<br />

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

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

sage: A*G.transpose() == zero_matrix(Q, 2, 2)<br />

True<br />

We check that number fields are h<strong>and</strong>led by the right routine as part <strong>of</strong> typical right kernel computation.<br />

sage: Q = QuadraticField(-7)<br />

sage: a = Q.gen(0)<br />

sage: A = matrix(Q, [[2, 5-a, 15-a, 16+4*a],[2+a, a, -7 + 5*a, -3+3*a]])<br />

sage: set_verbose(1)<br />

sage: A.right_kernel(algorithm=’default’)<br />

verbose ...<br />

verbose 1 () computing right kernel matrix over a number field for 2x4 matrix<br />

verbose 1 () done computing right kernel matrix over a number field for 2x4 matrix<br />

...<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 2 over Number Field in a with defining polynomial x^2<br />

Basis matrix:<br />

[ 1 0 7/88*a + 3/88 -3/176*a - 39/176]<br />

[ 0 1 -1/88*a - 13/88 13/176*a - 7/176]<br />

sage: set_verbose(0)<br />

Over the Finite Field <strong>of</strong> Order 2:<br />

Kernels are computed by the M4RI library using PLUQ matrix decomposition in the<br />

_right_kernel_matrix() method. There are no options for the algorithm used.<br />

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

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

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

sage: E = A.right_kernel_matrix(algorithm=’default’, format=’echelon’); E<br />

243

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

Saved successfully!

Ooh no, something went wrong!