def test_issue_10198(): assert reduce_inequalities(-1 + 1 / abs(1 / x - 1) < 0) == Or( And(-oo < x, x < 0), And(S(0) < x, x < S(1) / 2)) assert reduce_inequalities(abs(1 / sqrt(x)) - 1, x) == Eq(x, 1) assert reduce_abs_inequality(-3 + 1/abs(1 - 1/x), '<', x) == \ Or(And(-oo < x, x < 0), And(S(0) < x, x < S(3)/4), And(S(3)/2 < x, x < oo)) raises( ValueError, lambda: reduce_abs_inequality(-3 + 1 / abs(1 - 1 / sqrt(x)), '<', x))
def test_issue_10198(): assert reduce_inequalities(-1 + 1 / abs(1 / x - 1) < 0) == Or( And(-oo < x, x < 0), And(S.Zero < x, x < S.Half)) assert reduce_inequalities(abs(1 / sqrt(x)) - 1, x) == Eq(x, 1) assert reduce_abs_inequality(-3 + 1/abs(1 - 1/x), '<', x) == \ Or(And(-oo < x, x < 0), And(S.Zero < x, x < Rational(3, 4)), And(Rational(3, 2) < x, x < oo)) raises( ValueError, lambda: reduce_abs_inequality(-3 + 1 / abs(1 - 1 / sqrt(x)), '<', x))
def test_issue_10198(): assert reduce_inequalities( -1 + 1/abs(1/x - 1) < 0) == Or( And(-oo < x, x < 0), And(S(0) < x, x < S(1)/2) ) assert reduce_inequalities(abs(1/sqrt(x)) - 1, x) == Eq(x, 1) assert reduce_abs_inequality(-3 + 1/abs(1 - 1/x), '<', x) == \ Or(And(-oo < x, x < 0), And(S(0) < x, x < S(3)/4), And(S(3)/2 < x, x < oo)) raises(ValueError,lambda: reduce_abs_inequality(-3 + 1/abs( 1 - 1/sqrt(x)), '<', x))
def test_issue_8545(): from sympy import refine eq = 1 - x - abs(1 - x) ans = And(Lt(1, x), Lt(x, oo)) assert reduce_abs_inequality(eq, '<', x) == ans eq = 1 - x - sqrt((1 - x)**2) assert reduce_inequalities(refine(eq) < 0) == ans
def test_issue_8545(): eq = 1 - x - abs(1 - x) ans = And(Lt(1, x), Lt(x, oo)) assert reduce_abs_inequality(eq, '<', x) == ans eq = 1 - x - sqrt((1 - x)**2) assert reduce_inequalities(eq < 0) == ans
def test_issue_8545(): x = Symbol('x', real=True) eq = 1 - x - sqrt((1 - x)**2) assert reduce_abs_inequality(eq, '<', x) == And(Lt(1, x), Lt(x, oo))