Transformation to Jordan form for tame 6x6 integer matrix

200 views
Skip to first unread message

Rob Beezer

unread,
Oct 12, 2008, 10:34:12 PM10/12/08
to sage-support
I have a 6x6 matrix with integer entries, whose eigenvalues are also
integers. I wanted the Jordan canonical form, and the associated
matrix to make the similarity transformation. The Jordan form comes
out nicely, but I can't get the transformation matrix. I've included
the error output below - the error seems more severe without setting
base_ring=QQ. I've also include a legitimate transformation matrix I
worked up by hand (with some help from SAGE!).

Is this expected behavior? Any usage hints or workarounds? Thanks.

Rob


m=matrix(QQ, [[2,0,1,1,0,0],[0,2,1,1,0,0],[2,0,1,0,0,1],[2,0,0,1,1,0],
[0,2,1,0,0,1],[0,2,0,1,1,0]])
m.jordan_form()

[4|0|0 0|0 0]
[-+-+---+---]
[0|2|0 0|0 0]
[-+-+---+---]
[0|0|0 1|0 0]
[0|0|0 0|0 0]
[-+-+---+---]
[0|0|0 0|0 1]
[0|0|0 0|0 0]

p=m.jordan_form(base_ring=QQ, transformation=True)


Traceback (click to the left for traceback)
...
ValueError: cannot compute the basis of the Jordan block of size 2
with
eigenvalue 0

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rob/.sage/sage_notebook/worksheets/admin/46/code/98.py",
line 6, in <module>
p=m.jordan_form(base_ring=QQ, transformation=True)
File "/opt/sage-3.1.2/local/lib/python2.5/site-packages/
SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module>
File "matrix2.pyx", line 4125, in
sage.matrix.matrix2.Matrix.jordan_form (sage/matrix/matrix2.c:23429)
ValueError: cannot compute the basis of the Jordan block of size 2
with eigenvalue 0

p=matrix(QQ,[[1,1,0,1,3,1],[1,-1,0,1,3,1],[1,0,1,1,0,1],
[1,0,-1,-3,-6,0],[1,-2,1,0,0,-8],[1,-2,-1,-2,-6,-3]])
p.inverse()*m*p == m.jordan_form()

True

Marshall Hampton

unread,
Oct 12, 2008, 11:39:49 PM10/12/08
to sage-support
The transformation=True fails even for matrix(QQ,[[0,1,0],[0,0,0],
[0,0,0]]). It looks like the algorithm to construct it is flawed, and
will not work if there are blocks with the same eigenvalue. Anyone
want to re-write this?

-M. Hampton

Marshall Hampton

unread,
Oct 13, 2008, 7:58:42 AM10/13/08
to sage-support
This is now Ticket #4273 on trac (http://trac.sagemath.org/sage_trac/
ticket/4273).

I will try to fix this if no one else does. Many Sage developers are
busy at Sage Days 10 in Nancy, France, so they might be a little more
distracted than usual, but I think this is a major bug so it should
get attention soon.

-M. Hampton

Rob Beezer

unread,
Oct 13, 2008, 6:08:45 PM10/13/08
to sage-support
Thanks for the response and for submitting this as a bug. I should
have thought to try a simpler test case.

Rob

Marshall Hampton

unread,
Nov 18, 2008, 11:00:09 AM11/18/08
to sage-support
Jason Grout has now fixed this, you can get the patch at

http://trac.sagemath.org/sage_trac/ticket/4273

It probably won't get into Sage until sage-3.2.1, which has a target
release date of 11/22 but since 3.2 is turning into a pretty big
release I think it will be more like the end of the month.

Cheers,
Marshall Hampton

On Oct 13, 4:08 pm, Rob Beezer <goo...@beezer.cotse.net> wrote:
> Thanks for the response and for submitting this as a bug. I should
> have thought to try a simpler test case.
>
> Rob
>
> On Oct 13, 4:58 am, Marshall Hampton <hampto...@gmail.com> wrote:
>
> > This is now Ticket #4273 on trac (http://trac.sagemath.org/sage_trac/
> > ticket/4273).
>
> > I will try to fix this if no one else does. Many Sage developers are
> > busy at Sage Days 10 in Nancy, France, so they might be a little more
> > distracted than usual, but I think this is a major bug so it should
> > get attention soon.
>
> > -M. Hampton
>
> > On Oct 12, 10:39 pm, Marshall Hampton <hampto...@gmail.com> wrote:
>
> > > The transformation=True fails even for matrix(QQ,[[0,1,0],[0,0,0],
> > > [0,0,0]]). It looks like the algorithm to construct it is flawed, and
> > > will not work if there are blocks with the same eigenvalue. Anyone
> > > want to re-write this?
>
> > > -M. Hampton
>
> > > On Oct 12, 9:34 pm, Rob Beezer <goo...@beezer.cotse.net> wrote:
>
> > > > I have a 6x6 matrix with integer entries, whose eigenvalues are also
> > > > integers. I wanted theJordancanonical form, and the associated
> > > > matrix to make the similarity transformation. TheJordanform comes
> > > > out nicely, but I can't get the transformation matrix. I've included
> > > > the error output below - the error seems more severe without setting
> > > > base_ring=QQ. I've also include a legitimate transformation matrix I
> > > > worked up by hand (with some help from SAGE!).
>
> > > > Is this expected behavior? Any usage hints or workarounds? Thanks.
>
> > > > Rob
>
> > > > m=matrix(QQ, [[2,0,1,1,0,0],[0,2,1,1,0,0],[2,0,1,0,0,1],[2,0,0,1,1,0],
> > > > [0,2,1,0,0,1],[0,2,0,1,1,0]])
> > > > m.jordan_form()
>
> > > > [4|0|0 0|0 0]
> > > > [-+-+---+---]
> > > > [0|2|0 0|0 0]
> > > > [-+-+---+---]
> > > > [0|0|0 1|0 0]
> > > > [0|0|0 0|0 0]
> > > > [-+-+---+---]
> > > > [0|0|0 0|0 1]
> > > > [0|0|0 0|0 0]
>
> > > > p=m.jordan_form(base_ring=QQ, transformation=True)
>
> > > > Traceback (click to the left for traceback)
> > > > ...
> > > > ValueError: cannot compute the basis of theJordanblock of size 2
> > > > with
> > > > eigenvalue 0
>
> > > > Traceback (most recent call last):
> > > > File "<stdin>", line 1, in <module>
> > > > File "/home/rob/.sage/sage_notebook/worksheets/admin/46/code/98.py",
> > > > line 6, in <module>
> > > > p=m.jordan_form(base_ring=QQ, transformation=True)
> > > > File "/opt/sage-3.1.2/local/lib/python2.5/site-packages/
> > > > SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module>
> > > > File "matrix2.pyx", line 4125, in
> > > > sage.matrix.matrix2.Matrix.jordan_form (sage/matrix/matrix2.c:23429)
> > > > ValueError: cannot compute the basis of theJordanblock of size 2

William Stein

unread,
Nov 18, 2008, 11:09:45 AM11/18/08
to sage-s...@googlegroups.com
On Tue, Nov 18, 2008 at 8:00 AM, Marshall Hampton <hamp...@gmail.com> wrote:
>
> Jason Grout has now fixed this, you can get the patch at
>
> http://trac.sagemath.org/sage_trac/ticket/4273
>
> It probably won't get into Sage until sage-3.2.1, which has a target
> release date of 11/22 but since 3.2 is turning into a pretty big
> release I think it will be more like the end of the month.

3.2 should be released in <= 2 days.
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages