Comment #5 on issue 1985 by asmeurer: as_real_imag() gives wrong answer when expanding quotient
http://code.google.com/p/sympy/issues/detail?id=1985

You usually want the two in pairs, so I think as_real_imag() has its place. I just do not at all like that code that assumes "term.as_coeffcient(I) is None" implies term.is_real. Obviously, expand(complex=True) does not always adhere to this invariant. Maybe we should merge the _eval_expand_complex() code with the as_real_imag() code. It looks like _eval_expand_complex always knows what the real and imaginary parts are (it always returns some kind of real_part + im_part*I, see for example Pow._eval_expand_complex()), so instead of making as_real_imag() guess what those are, just do it directly in the expand function that already knows. Probably the best way to do this would be to move the _eval_expand_complex() code into .as_real_imag() methods, and just have _eval_expand_complex() do

re_part, im_part = self.as_real_imag()
return re_part + im_part*S.ImaginaryUnit

--
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