Updates:
Labels: NeedsReview
Comment #7 on issue 1985 by renato.c...@gmail.com: as_real_imag() gives
wrong answer when expanding quotient
http://code.google.com/p/sympy/issues/detail?id=1985
Ok, my first (naive) tries were very unsuccessful. It turns out ask() works
for simple cases, but doesn't for complex ones, ending up in infinite
recursion. It's not possible to use re(term) and im(term) also, because it
ends up in infinite recursion again. Since everything uses as_real_imag()
themselves, it's hard to find some way out.
I did try something that worked for this case, but there's no guarantee
it'll be always correct: I expanded with complex=False first, and then
expanded complex. This eliminates all complex (in the complicated sense)
quotients before using any complex (in the mathematical sense) features, so
no recursion appeared. The patch is at one branch in github,
renatocoutinho/issue1985, with a test included. I originally had forked the
git.sympy.org repo, don't know if that is a problem.
I can't see what would be the ideal (one that always works) solution here,
because of the inter-dependencies. For now, I couldn't think of any
counter-example to the code with the patch, I will try harder later.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.