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.

CHAPTER<br />

EIGHTEEN<br />

DENSE MATRICES OVER THE<br />

RATIONAL FIELD<br />

Dense matrices over the rational field<br />

EXAMPLES:<br />

We create a 3x3 matrix with rational entries <strong>and</strong> do some operations with it.<br />

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

[ 1 2/3 -4/5]<br />

[ 1 1 1]<br />

[ 8 2 -3/19]<br />

sage: a.det()<br />

2303/285<br />

sage: a.charpoly()<br />

x^3 - 35/19*x^2 + 1259/285*x - 2303/285<br />

sage: b = a^(-1); b<br />

[ -615/2303 -426/2303 418/2303]<br />

[ 2325/2303 1779/2303 -513/2303]<br />

[-1710/2303 950/2303 95/2303]<br />

sage: b.det()<br />

285/2303<br />

sage: a == b<br />

False<br />

sage: a < b<br />

False<br />

sage: b < a<br />

True<br />

sage: a > b<br />

True<br />

sage: a*b<br />

[1 0 0]<br />

[0 1 0]<br />

[0 0 1]<br />

TESTS:<br />

sage: a = matrix(QQ,2,range(4), sparse=False)<br />

sage: TestSuite(a).run()<br />

class sage.matrix.matrix_rational_dense.MatrixWindow<br />

Bases: object<br />

x.__init__(...) initializes x; see help(type(x)) for signature<br />

339

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

Saved successfully!

Ooh no, something went wrong!