sympy/sympy — pull request #7900 by smichr (2014-08-21 14:27:48+00:00)
Title: 7895: Pow.as_real_imag correction: must know sign of im or re

fixes #7895 (see issue for description)

Also, the test for issue 6121 was changed to a simple assertion since the
original issue involved an infinite recursion. The new result is
a little different than the old result but there is no error.

old result:
([(x0, re(x)), (x1, im(x)), (x2, atan2(x1, x0)/2), (x3, sin(x2)), (x4,
cos(x2))],
[sqrt(2)*(x3 + I*x3 - x4 + I*x4)/(8*pi**(3/2)*(x0**2 + x1**2)**(1/4))])

new result:
([(x0, 1/sqrt(re(x) + I*im(x))), (x1, re(x0)), (x2, im(x0))],
[sqrt(2)*(-x1 + I*x1 - x2 - I*x2)/(8*pi**(3/2))])