sympy/sympy — pull request #1304 by scolobb (2012-05-19 13:28:05+00:00)
Title: Make re and im call as_real_imag()  (Fix Issue 754).

This fix adds a new hint to `as_real_imag()` which prevents this function to start a infinite chain of recursive calls of the form re(x) -> x.as_real_imag() -> re(x). Apparently, this is the only way to run into infinite recursion errors by having `re` and `im` call `as_real_imag()` and vice versa.

`as_real_imag()` seems to make use of complex `expand(complex=True)` whenever necessary. This fix makes the latest examples in [Issue 754](http://code.google.com/p/sympy/issues/detail?id=754) work.