Skip to content

Commit

Permalink
Merge pull request #146 from skirpichev/fix-10198
Browse files Browse the repository at this point in the history
Allow negative powers of abs in the reduce_abs_inequality
  • Loading branch information
skirpichev committed Dec 8, 2015
2 parents 697a2a2 + e99fb23 commit 3cdc368
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sympy/solvers/inequalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,8 @@ def _bottom_up_scan(expr):
elif expr.is_Pow:
n = expr.exp

if not n.is_Integer or n < 0:
raise ValueError(
"only non-negative integer powers are allowed")
if not n.is_Integer:
raise NotImplementedError("only integer powers are supported")

_exprs = _bottom_up_scan(expr.base)

Expand Down
4 changes: 4 additions & 0 deletions sympy/solvers/tests/test_inequalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def test_reduce_abs_inequalities():
nr = Symbol('nr', extended_real=False)
raises(TypeError, lambda: reduce_inequalities(abs(nr - 5) < 3))

# sympy/sympy#10198
assert reduce_inequalities(-1 + 1/abs(1/x - 1) < 0) == \
Or(And(S.Zero < x, x < S.Half), And(-oo < x, x < S.Zero))


def test_reduce_inequalities_general():
assert reduce_inequalities(Ge(sqrt(2)*x, 1)) == And(sqrt(2)/2 <= x, x < oo)
Expand Down

0 comments on commit 3cdc368

Please sign in to comment.