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

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

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

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

sage: E = matrix(QQ, [[ 0, -8, 4, -6, -2, 5, -3, 11],<br />

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

... [ 5, 14, -7, 12, 3, -8, 6, -27],<br />

... [-3, -8, 7, -5, 0, 2, -6, 17],<br />

... [ 0, 5, 0, 2, 4, -4, 1, 2],<br />

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

... [ 6, 18, -10, 14, 4, -10, 10, -28],<br />

... [-2, -6, 4, -5, -1, 3, -3, 13]])<br />

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

(x - 2)^3<br />

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

(x - 2)^8<br />

sage: E.rational_form()<br />

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

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

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

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

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

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

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

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

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

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

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

The principal feature <strong>of</strong> rational canonical form is that it can be computed over any field using only field<br />

operations. Other forms, such as Jordan canonical form, are complicated by the need to determine the<br />

eigenvalues <strong>of</strong> the matrix, which can lie outside the field. The following matrix has all <strong>of</strong> its eigenvalues<br />

outside the rationals - some are irrational (± √ 2) <strong>and</strong> the rest are complex (−1 ± 2i).<br />

sage: A = matrix(QQ,<br />

... [[-154, -3, -54, 44, 48, -244, -19, 67, -326, 85, 355, 581],<br />

... [ 504, 25, 156, -145, -171, 793, 99, -213, 1036, -247, -1152, -1865],<br />

... [ 294, -1, 112, -89, -90, 469, 36, -128, 634, -160, -695, -1126],<br />

... [ -49, -32, 25, 7, 37, -64, -58, 12, -42, -14, 72, 106],<br />

... [-261, -123, 65, 47, 169, -358, -254, 70, -309, -29, 454, 673],<br />

... [-448, -123, -10, 109, 227, -668, -262, 163, -721, 95, 896, 1410],<br />

... [ 38, 7, 8, -14, -17, 66, 6, -23, 73, -29, -78, -143],<br />

... [ -96, 10, -55, 37, 24, -168, 17, 56, -231, 88, 237, 412],<br />

... [ 310, 67, 31, -81, -143, 473, 143, -122, 538, -98, -641, -1029],<br />

... [ 139, -35, 99, -49, -18, 236, -41, -70, 370, -118, -377, -619],<br />

... [ 243, 9, 81, -72, -81, 386, 43, -105, 508, -124, -564, -911],<br />

... [-155, -3, -55, 45, 50, -245, -27, 65, -328, 77, 365, 583]])<br />

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

(x^2 - 2)^2 * (x^2 + 2*x + 5)^4<br />

sage: A.eigenvalues(extend=False)<br />

[]<br />

sage: A.rational_form()<br />

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

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

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

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

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

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

227

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

Saved successfully!

Ooh no, something went wrong!