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

-6/5*x^2*y^2 - 3*x*y^3 + 6/5*x^2*y + 11/12*x*y^2 - 18*y^2 - 3/4*y<br />

sage: C.change_ring(R.change_ring(QQbar)).det()<br />

(-6/5)*x^2*y^2 + (-3)*x*y^3 + 6/5*x^2*y + 11/12*x*y^2 + (-18)*y^2 + (-3/4)*y<br />

Finally, we check whether the Singular interface is working:<br />

sage: R. = RR[]<br />

sage: C = r<strong>and</strong>om_matrix(R, 2, 2, terms=2)<br />

sage: C<br />

[0.368965517352886*y^2 + 0.425700773972636*x -0.800362171389760*y^2 - 0.807635502485287]<br />

[ 0.706173539423122*y^2 - 0.915986060298440 0.897165181570476*y + 0.107903328188376]<br />

sage: C.determinant()<br />

0.565194587390682*y^4 + 0.331023015369146*y^3 + 0.381923912175852*x*y - 0.122977163520282*y^<br />

ALGORITHM: Calls Singular, libSingular or native implementation.<br />

TESTS:<br />

sage: R = PolynomialRing(QQ, 9, ’x’)<br />

sage: matrix(R, 0, 0).det()<br />

1<br />

sage: R. = QQ[]<br />

sage: m = matrix([[y,y,y,y]] * 4) # larger than 3x3<br />

sage: m.charpoly() # put charpoly in the cache<br />

x^4 - 4*y*x^3<br />

sage: m.det()<br />

0<br />

echelon_form(algorithm=’row_reduction’, **kwds)<br />

Return an echelon form <strong>of</strong> self using chosen algorithm.<br />

By default only a usual row reduction with no divisions or column swaps is returned.<br />

If Gauss-Bareiss algorithm is chosen,<br />

swapped_columns().<br />

INPUT:<br />

column swaps are recorded <strong>and</strong> can be retrieved via<br />

•algorithm – string, which algorithm to use (default: ‘row_reduction’). Valid options are:<br />

OUTPUT:<br />

–’row_reduction’ (default) – reduce as far as possible, only divide by constant entries<br />

–’frac’ – reduced echelon form over fraction field<br />

–’bareiss’ – fraction free Gauss-Bareiss algorithm with column swaps<br />

The row echelon form <strong>of</strong> A depending on the chosen algorithm, as an immutable matrix. Note that self<br />

is not changed by this comm<strong>and</strong>. Use A.echelonize()‘ to change A in place.<br />

EXAMPLES:<br />

sage: P. = PolynomialRing(GF(127), 2)<br />

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

sage: A<br />

[1 x]<br />

[1 y]<br />

sage: A.echelon_form()<br />

[ 1 x]<br />

[ 0 -x + y]<br />

400 Chapter 22. Dense matrices over multivariate polynomials over fields

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

Saved successfully!

Ooh no, something went wrong!