Comment #23 on issue 2607 by asmeurer: as_numer_denom() is too slow
http://code.google.com/p/sympy/issues/detail?id=2607

The expression with z is the one that causes he hyperexpand failure (I don't know if you got that). I didn't dig down to see what caused the Matrix error, but I suspect it's the same sort of thing.

evaluate=False seems a little unstable to me, especially considering how small changes can cause them to become evaluated (by the way, I don't think that "touching" an unevaluated expression should evaluate it; it should remain unevaluated no matter what you do to it)..

I think it would be better to just manually separate numerical denominators. Do you think that would work in all cases? The algorithm would be slightly more complicated, but it would be more clean than evaluate=False imho.

I think as_numer_denom of a noncommutative power should always return (NC, 1); that would solve the problem without having to raise an error.

Well, it depends on what you expect as_numer_denom to return. To me, it has some kind of guarantee on it that here are no negative powers returned. We could also make it return (self, 1) in any case, but this would break code, because code expects it to actually do something, in particular, to find a common denominator. So I rather think raising an error when we can't do it is better.

Of course, sometimes it can be done. But I don't particularly feel like implementing a non-commutative algorithm/heuristic (you can do it if you want).

By the way, you should never write a non-commutative as 1/A. Always write A**-1 or A*B**-1. This makes it clear if you are multiplying by the inverse on the left or on the right. (see also issue 2532).

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to