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

The reduced row echelon form over the fraction field is as follows:<br />

sage: A.echelon_form(’frac’) # over fraction field<br />

[1 0]<br />

[0 1]<br />

Alternatively, the Gauss-Bareiss algorithm may be chosen:<br />

sage: E = A.echelon_form(’bareiss’); E<br />

[ 1 y]<br />

[ 0 x - y]<br />

After the application <strong>of</strong> the Gauss-Bareiss algorithm the swapped columns may inspected:<br />

sage: E.swapped_columns(), E.pivots()<br />

((0, 1), (0, 1))<br />

sage: A.swapped_columns(), A.pivots()<br />

(None, (0, 1))<br />

Another approach is to row reduce as far as possible:<br />

sage: A.echelon_form(’row_reduction’)<br />

[ 1 x]<br />

[ 0 -x + y]<br />

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

Transform self into a matrix in echelon form over the same base ring as self.<br />

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

swapped_columns().<br />

INPUT:<br />

•algorithm – string, which algorithm to use. Valid options are:<br />

EXAMPLES:<br />

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

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

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

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

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

sage: A<br />

[ 1/2 x]<br />

[ 1 3/4*y + 1]<br />

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

sage: B.echelonize(’bareiss’); B<br />

[ 1 3/4*y + 1]<br />

[ 0 x - 3/8*y - 1/2]<br />

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

sage: B.echelonize(’row_reduction’); B<br />

[ 1 2*x]<br />

[ 0 -2*x + 3/4*y + 1]<br />

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

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

[2 x 0]<br />

[3 y 1]<br />

401

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

Saved successfully!

Ooh no, something went wrong!