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

sage: a = matrix(QQ, 4, range(16)); a[0,0] = 1/19; a[0,1] = 1/5<br />

sage: a.echelonize(algorithm=’multimodular’); a<br />

[ 1 0 0 -76/157]<br />

[ 0 1 0 -5/157]<br />

[ 0 0 1 238/157]<br />

[ 0 0 0 0]<br />

height()<br />

Return the height <strong>of</strong> this matrix, which is the maximum <strong>of</strong> the absolute values <strong>of</strong> all numerators <strong>and</strong><br />

denominators <strong>of</strong> entries in this matrix.<br />

OUTPUT: an Integer<br />

EXAMPLES:<br />

sage: b = matrix(QQ,2,range(6)); b[0,0]=-5007/293; b<br />

[-5007/293 1 2]<br />

[ 3 4 5]<br />

sage: b.height()<br />

5007<br />

invert(check_invertible=True, algorithm=’default’)<br />

Compute the inverse <strong>of</strong> this matrix.<br />

Warning: This function is deprecated. Use inverse instead.<br />

EXAMPLES:<br />

sage: a = matrix(QQ,3,range(9))<br />

sage: a.invert()<br />

Traceback (most recent call last):<br />

...<br />

ZeroDivisionError: input matrix must be nonsingular<br />

minpoly(var=’x’, algorithm=’linbox’)<br />

Return the minimal polynomial <strong>of</strong> this matrix.<br />

INPUT:<br />

•var - ‘x’ (string)<br />

•algorithm - ‘linbox’ (default) or ‘generic’<br />

OUTPUT: a polynomial over the rational numbers.<br />

EXAMPLES:<br />

sage: a = matrix(QQ, 3, [4/3, 2/5, 1/5, 4, -3/2, 0, 0, -2/3, 3/4])<br />

sage: f = a.minpoly(); f<br />

x^3 - 7/12*x^2 - 149/40*x + 97/30<br />

sage: a = Mat(ZZ,4)(range(16))<br />

sage: f = a.minpoly(); f.factor()<br />

x * (x^2 - 30*x - 80)<br />

sage: f(a) == 0<br />

True<br />

sage: a = matrix(QQ, 4, [1..4^2])<br />

sage: factor(a.minpoly())<br />

x * (x^2 - 34*x - 80)<br />

sage: factor(a.minpoly(’y’))<br />

y * (y^2 - 34*y - 80)<br />

345

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

Saved successfully!

Ooh no, something went wrong!