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: all(polys[i].divides(polys[i+1]) for i in range(len(polys)-1))<br />

True<br />

sage: polys[-1] == A.minimal_polynomial(var=’x’)<br />

True<br />

sage: prod(polys) == A.characteristic_polynomial(var=’x’)<br />

True<br />

Rational form is a canonical form. Any two matrices are similar if <strong>and</strong> only if their rational forms are<br />

equal. By starting with Jordan canonical forms, the matrices C <strong>and</strong> D below were built as similar matrices,<br />

while E was built to be just slightly different. All three matrices have equal characteristic polynomials<br />

though E‘s minimal polynomial differs.<br />

sage: C = matrix(QQ, [[2, 31, -10, -9, -125, 13, 62, -12],<br />

... [0, 48, -16, -16, -188, 20, 92, -16],<br />

... [0, 9, -1, 2, -33, 5, 18, 0],<br />

... [0, 15, -5, 0, -59, 7, 30, -4],<br />

... [0, -21, 7, 2, 84, -10, -42, 5],<br />

... [0, -42, 14, 8, 167, -17, -84, 13],<br />

... [0, -50, 17, 10, 199, -23, -98, 14],<br />

... [0, 15, -5, -2, -59, 7, 30, -2]])<br />

sage: C.minimal_polynomial().factor()<br />

(x - 2)^2<br />

sage: C.characteristic_polynomial().factor()<br />

(x - 2)^8<br />

sage: C.rational_form()<br />

[ 0 -4| 0 0| 0 0| 0 0]<br />

[ 1 4| 0 0| 0 0| 0 0]<br />

[-----+-----+-----+-----]<br />

[ 0 0| 0 -4| 0 0| 0 0]<br />

[ 0 0| 1 4| 0 0| 0 0]<br />

[-----+-----+-----+-----]<br />

[ 0 0| 0 0| 0 -4| 0 0]<br />

[ 0 0| 0 0| 1 4| 0 0]<br />

[-----+-----+-----+-----]<br />

[ 0 0| 0 0| 0 0| 0 -4]<br />

[ 0 0| 0 0| 0 0| 1 4]<br />

sage: D = matrix(QQ, [[ -4, 3, 7, 2, -4, 5, 7, -3],<br />

... [ -6, 5, 7, 2, -4, 5, 7, -3],<br />

... [ 21, -12, 89, 25, 8, 27, 98, -95],<br />

... [ -9, 5, -44, -11, -3, -13, -48, 47],<br />

... [ 23, -13, 74, 21, 12, 22, 85, -84],<br />

... [ 31, -18, 135, 38, 12, 47, 155, -147],<br />

... [-33, 19, -138, -39, -13, -45, -156, 151],<br />

... [ -7, 4, -29, -8, -3, -10, -34, 34]])<br />

sage: D.minimal_polynomial().factor()<br />

(x - 2)^2<br />

sage: D.characteristic_polynomial().factor()<br />

(x - 2)^8<br />

sage: D.rational_form()<br />

[ 0 -4| 0 0| 0 0| 0 0]<br />

[ 1 4| 0 0| 0 0| 0 0]<br />

[-----+-----+-----+-----]<br />

[ 0 0| 0 -4| 0 0| 0 0]<br />

[ 0 0| 1 4| 0 0| 0 0]<br />

[-----+-----+-----+-----]<br />

[ 0 0| 0 0| 0 -4| 0 0]<br />

[ 0 0| 0 0| 1 4| 0 0]<br />

226 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!