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

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

...<br />

RuntimeError: Some eigenvalue does not exist in Rational Field.<br />

sage: b.jordan_form(RealField(15))<br />

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

...<br />

ValueError: Jordan normal form not implemented over inexact rings.<br />

If you need the transformation matrix as well as the Jordan form <strong>of</strong> self, then pass the option<br />

transformation=True.<br />

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

[ 5 4 2 1]<br />

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

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

[ 1 1 -1 2]<br />

sage: jf, p = m.jordan_form(transformation=True)<br />

sage: jf<br />

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

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

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

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

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

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

sage: ~p * m * p<br />

[2 0 0 0]<br />

[0 1 0 0]<br />

[0 0 4 1]<br />

[0 0 0 4]<br />

Note that for matrices over inexact rings <strong>and</strong> associated numerical stability problems, we do not attempt to<br />

compute the Jordan normal form.<br />

sage: b = matrix(ZZ,3,3,range(9))<br />

sage: jf, p = b.jordan_form(RealField(15), transformation=True)<br />

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

...<br />

ValueError: Jordan normal form not implemented over inexact rings.<br />

TESTS:<br />

sage: c = matrix(ZZ, 3, [1]*9); c<br />

[1 1 1]<br />

[1 1 1]<br />

[1 1 1]<br />

sage: c.jordan_form(subdivide=False)<br />

[3 0 0]<br />

[0 0 0]<br />

[0 0 0]<br />

sage: evals = [(i,i) for i in range(1,6)]<br />

sage: n = sum(range(1,6))<br />

sage: jf = block_diagonal_matrix([jordan_block(ev,size) for ev,size in evals])<br />

sage: p = r<strong>and</strong>om_matrix(ZZ,n,n)<br />

sage: while p.rank() != n: p = r<strong>and</strong>om_matrix(ZZ,n,n)<br />

sage: m = p * jf * ~p<br />

sage: mjf, mp = m.jordan_form(transformation=True)<br />

sage: mjf == jf<br />

True<br />

197

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

Saved successfully!

Ooh no, something went wrong!