# Why does jordan_form not work over inexact rings?

Hi,

Given a matrix M with entries (variables) in SR, I needed to compute the transformation matrix to a jordan form of M.

I ended up copying the code in "jordan_form" and "_jordan_form_vector_in_difference" from "matrix2.pyx", deleting the "if (base_ring is None and not self.base_ring().is_exact()) ..." and replacing "evals = A.charpoly().roots()" by

    eigenvects=A.eigenvectors_right()
evals=[(eigenvect[0],eigenvect[2]) for eigenvect in eigenvects]


So far it seems to work. Can this go wrong? Or could one just change the original code in matrix2.pyx, and allow inexact rings?

edit retag close merge delete

Sort by ยป oldest newest most voted

Thanks for the answer. I want to compute [the transformation matrix to] the Jordan normal forms of block matrices whose blocks are of the form

[   d0    d1    d2   d3]
[    0    d0    d1   d2]
[    0     0    d0   d1]
[    0     0     0   d0]


(i.e. an upper triangular Toeplitz matrix whose entries are variables or 0).

more

I am curious to see what does Sage answers on this particular example. If there is no asumption on the di, the following non equivalent answers are possible:

[   d0     1     0    0]
[    0    d0     1    0]
[    0     0    d0    1]
[    0     0     0   d0]

[   d0     0     0    0]
[    0    d0     0    0]
[    0     0    d0    0]
[    0     0     0   d0]

more

Actually, there is only one possibility. The matrix M-d0*I has a one-dim kernel if d1 is non-zero, so there's only one Jordan block.The symbolic ring has issues, but for simple polynomial algebra its properties are fairly regular: a variable like d1 is simply a transcendental element, so in particular non-zero. (SR tries to model a domain)

( 2013-09-01 16:32:32 +0200 )edit

Please could you provide the entries of your matrix more precisely ?

You should notice that things like x or even cos(x) are elements of the Symbolic Ring, and i doubt that your method will work correcly with such entries. the Symbolic Ring also contains elements of RR for which the computation of eigenvalues is not reliable.

Depending on your entries, it could make sense to send them to an exact ring first (e.g. the algebraic numbers).

Also, if your entries are numerical, you should convert them in RDF for which the computation of eigenvalues is OK.

more

Yes, it's the "right" result, so

[   d0     1     0    0]
[    0    d0     1    0]
[    0     0    d0    1]
[    0     0     0   d0]


@nbruin: So you are saying that in general there shouldn't be a problem in my case?

more

You managed to compute the correct answer, didn't you? It's just that you can't expect the general code to perform well on non-exact input, since numerical stability would have to be taken into account. And SR has elements that should be considered non-exact. If you have further design questions about sage, please send them to a discussion group such as sage-support or sage-devel. Asksage is an awkward forum for discussion.

( 2013-09-02 21:13:44 +0200 )edit