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

These coefficients include the leading one <strong>of</strong> the monic polynomial <strong>and</strong> are ready to be coerced into any<br />

polynomial ring over the same field (see examples <strong>of</strong> this below). This return value is intended to be the<br />

most compact representation <strong>and</strong> the easiest to use for testing equality <strong>of</strong> rational forms.<br />

Because the minimal <strong>and</strong> characteristic polynomials <strong>of</strong> a companion matrix are the associated polynomial,<br />

it is easy to see that the product <strong>of</strong> the polynomials <strong>of</strong> the blocks will be the characteristic polynomial <strong>and</strong><br />

the final polynomial will be the minimal polynomial <strong>of</strong> the entire matrix.<br />

ALGORITHM:<br />

We begin with ZigZag form, which is due to Arne Storjohann <strong>and</strong> is documented at zigzag_form().<br />

Then we eliminate ‘’corner” entries enroute to rational form via an additional algorithm <strong>of</strong> Storjohann’s<br />

[STORJOHANN-EMAIL].<br />

EXAMPLES:<br />

The lists <strong>of</strong> coefficients returned with the invariants keyword are designed to easily convert to the<br />

polynomials associated with the companion matrices. This is illustrated by the construction below <strong>of</strong> the<br />

polys list. Then we can test the divisibility condition on the list <strong>of</strong> polynomials. Also the minimal <strong>and</strong><br />

characteristic polynomials are easy to determine from this list.<br />

sage: A = matrix(QQ, [[ 11, 14, -15, -4, -38, -29, 1, 23, 14, -63, 17, 24, 36, 32],<br />

... [ 18, 6, -17, -11, -31, -43, 12, 26, 0, -69, 11, 13, 17, 24],<br />

... [ 11, 16, -22, -8, -48, -34, 0, 31, 16, -82, 26, 31, 39, 37],<br />

... [ -8, -18, 22, 10, 46, 33, 3, -27, -12, 70, -19, -20, -42, -31],<br />

... [-13, -21, 16, 10, 52, 43, 4, -28, -25, 89, -37, -20, -53, -62],<br />

... [ -2, -6, 0, 0, 6, 10, 1, 1, -7, 14, -11, -3, -10, -18],<br />

... [ -9, -19, -3, 4, 23, 30, 8, -3, -27, 55, -40, -5, -40, -69],<br />

... [ 4, -8, -1, -1, 5, -4, 9, 5, -11, 4, -14, -2, -13, -17],<br />

... [ 1, -2, 16, -1, 19, -2, -1, -17, 2, 19, 5, -25, -7, 14],<br />

... [ 7, 7, -13, -4, -26, -21, 3, 18, 5, -40, 7, 15, 20, 14],<br />

... [ -6, -7, -12, 4, -1, 18, 3, 8, -11, 15, -18, 17, -15, -41],<br />

... [ 5, 11, -11, -3, -26, -19, -1, 14, 10, -42, 14, 17, 25, 23],<br />

... [-16, -15, 3, 10, 29, 45, -1, -13, -19, 71, -35, -2, -35, -65],<br />

... [ 4, 2, 3, -2, -2, -10, 1, 0, 3, -11, 6, -4, 6, 17]]<br />

sage: A.rational_form()<br />

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

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

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

[ 0 0| 0 0 0 12| 0 0 0 0 0 0 0 0]<br />

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

[ 0 0| 0 1 0 -9| 0 0 0 0 0 0 0 0]<br />

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

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

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

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

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

[ 0 0| 0 0 0 0| 0 0 1 0 0 0 0 -271]<br />

[ 0 0| 0 0 0 0| 0 0 0 1 0 0 0 -41]<br />

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

[ 0 0| 0 0 0 0| 0 0 0 0 0 1 0 -64]<br />

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

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

sage: invariants = A.rational_form(format=’invariants’)<br />

sage: invariants<br />

[[4, -4, 1], [-12, 4, 9, -6, 1], [216, -108, -306, 271, 41, -134, 64, -13, 1]]<br />

sage: polys = [R(p) for p in invariants]<br />

sage: [p.factor() for p in polys]<br />

[(x - 2)^2, (x - 3) * (x + 1) * (x - 2)^2, (x + 1)^2 * (x - 3)^3 * (x - 2)^3]<br />

225

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

Saved successfully!

Ooh no, something went wrong!