Skip to content

Commit

Permalink
Merge pull request #1 from smichr/sachin1
Browse files Browse the repository at this point in the history
3532: Pow.is_real fix for base = -1
  • Loading branch information
sachin004 committed Nov 25, 2012
2 parents 9bb61ed + b0edda5 commit c870c5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sympy/core/power.py
Expand Up @@ -217,6 +217,8 @@ def _eval_is_real(self):
self.base in [S.ImaginaryUnit, -S.ImaginaryUnit]):
return True
if real_b and im_e:
if self.base is S.NegativeOne:
return True
c = self.exp.coeff(S.ImaginaryUnit)
if c:
ok = (c*C.log(self.base)/S.Pi).is_Integer
Expand Down
7 changes: 7 additions & 0 deletions sympy/core/tests/test_assumptions.py
Expand Up @@ -613,3 +613,10 @@ def test_inconsistent():
# cf. issues 2696 and 2446
raises(InconsistentAssumptions, lambda: Symbol('x', real=True,
commutative=False))


def test_issue_3532():
assert ((-1)**(I)).is_real is True
assert ((-1)**(I*2)).is_real is True
assert ((-1)**(I/2)).is_real is True
assert ((-1)**(I*S.Pi)).is_real is True

0 comments on commit c870c5c

Please sign in to comment.