Comment #1 on issue 1600 by asmeurer: abs(im(-(-2)**(S(1)/3))) fails (but only once) http://code.google.com/p/sympy/issues/detail?id=1600
I bisected and narrowed it down to this commit. Not sure what in there is causing the problem: commit adc894ab32ec250abaa3fbe8f9821aa87a9dbd92 Author: Mateusz Paprocki <[email protected]> Date: Sun Mar 1 04:43:46 2009 +0100 Fixed Pow._eval_is_real for sqrt(-1 - sqrt(2)) case diff --git a/sympy/core/power.py b/sympy/core/power.py index 580b7cb..49330e1 100644 --- a/sympy/core/power.py +++ b/sympy/core/power.py @@ -177,10 +177,12 @@ def _eval_is_real(self): if c1 and c2: if self.base.is_positive: return True - else: # negative or zero (or positive) if self.exp.is_integer: return True + elif self.base.is_negative: + if self.exp.is_Rational: + return False def _eval_is_odd(self): if not (self.base.is_integer and self.exp.is_nonnegative): return @@ -654,3 +656,4 @@ def _sage_(self): import numbers as _ _.Pow = Pow del _ + diff --git a/sympy/core/tests/test_arit.py b/sympy/core/tests/test_arit.py index 9e9f3d9..bbc86f6 100644 --- a/sympy/core/tests/test_arit.py +++ b/sympy/core/tests/test_arit.py @@ -799,8 +799,10 @@ def test_Pow_is_real(): assert (x**x).is_real == None assert (y**x).is_real == True - assert (x**Rational(1,3)).is_real == None - assert (y**Rational(1,3)).is_real == True + assert (x**Rational(1,3)).is_real == None + assert (y**Rational(1,3)).is_real == True + + assert sqrt(-1 - sqrt(2)).is_real == False @XFAIL def test_Pow_is_bounded(): -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- 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.
