Ask Your Question
0

Adjoint of symbolic matrix fails due to type conversion

asked 2013-07-19 11:00:37 -0600

MvG gravatar image

Trying the following code

var('x')
Matrix([[sqrt(x),x],[1,0]]).adjoint()

I get an error message

TypeError: no conversion of this rational to integer

This seems very strange to me. Computing the adjoint of any matrix should be possible, without requiring the elements to be rational, integral or anything else special. Over the symbolic ring in particular, it should always be possible to write the minors as expressions, perhaps without any evaluation or simplification in cases where doing more might cause trouble.

Surprisingly, computing the inverse works without issues. This is despite the fact that inversion requires division, and thus entails the danger of division by zero, where computing the adjoint does not. So one workaround might be multiplying the inverse by the determinant. But this will fail for some matrices where computing the adjoint should work. And it might also leave behind divisions within the elements, which might be difficult to get rid of without changing other radical changes to the form of the involved expressions. I just had a more complicated example where simplify left the division and simplify_full split square roots in a rather unreadable fashion.

Is there a valid explanation for the above behavior, or is this a bug?
Is there a better way to work around this problem?

edit retag flag offensive close merge delete

Comments

3

This is a bug in symbolic charpoly, see also http://trac.sagemath.org/14403

Volker Braun gravatar imageVolker Braun ( 2013-07-19 16:53:33 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2013-07-23 00:03:22 -0600

MvG gravatar image

As Volker Braun pointed out in a comment, this is a known bug. I just wrote a patch to fix this, and submitted it there. Let's see how the devs like it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-07-19 11:00:37 -0600

Seen: 134 times

Last updated: Jul 23 '13