/

# Inequality Solvers¶

sympy.solvers.inequalities.solve_rational_inequalities(eqs)[source]

Solve a system of rational inequalities with rational coefficients.

Examples

>>> from sympy.abc import x
>>> from sympy import Poly
>>> from sympy.solvers.inequalities import solve_rational_inequalities

>>> solve_rational_inequalities([[
... ((Poly(-x + 1), Poly(1, x)), '>='),
... ((Poly(-x + 1), Poly(1, x)), '<=')]])
{1}

>>> solve_rational_inequalities([[
... ((Poly(x), Poly(1, x)), '!='),
... ((Poly(-x + 1), Poly(1, x)), '>=')]])
(-oo, 0) U (0, 1]

sympy.solvers.inequalities.solve_poly_inequality(poly, rel)[source]

Solve a polynomial inequality with rational coefficients.

See also

solve_poly_inequalities

Examples

>>> from sympy import Poly
>>> from sympy.abc import x
>>> from sympy.solvers.inequalities import solve_poly_inequality

>>> solve_poly_inequality(Poly(x, x, domain='ZZ'), '==')
[{0}]

>>> solve_poly_inequality(Poly(x**2 - 1, x, domain='ZZ'), '!=')
[(-oo, -1), (-1, 1), (1, oo)]

>>> solve_poly_inequality(Poly(x**2 - 1, x, domain='ZZ'), '==')
[{-1}, {1}]

sympy.solvers.inequalities.reduce_rational_inequalities(exprs, gen, assume=True, relational=True)[source]

Reduce a system of rational inequalities with rational coefficients.

Examples

>>> from sympy import Poly, Symbol
>>> from sympy.solvers.inequalities import reduce_rational_inequalities

>>> x = Symbol('x', real=True)

>>> reduce_rational_inequalities([[x**2 <= 0]], x)
x == 0

>>> reduce_rational_inequalities([[x + 2 > 0]], x)
x > -2
>>> reduce_rational_inequalities([[(x + 2, ">")]], x)
x > -2
>>> reduce_rational_inequalities([[x + 2]], x)
x == -2

sympy.solvers.inequalities.reduce_abs_inequality(expr, rel, gen, assume=True)[source]

Reduce an inequality with nested absolute values.

Examples

>>> from sympy import Q, Abs
>>> from sympy.abc import x
>>> from sympy.solvers.inequalities import reduce_abs_inequality

>>> reduce_abs_inequality(Abs(x - 5) - 3, '<', x, assume=Q.real(x))
And(2 < x, x < 8)

>>> reduce_abs_inequality(Abs(x + 2)*3 - 13, '<', x, assume=Q.real(x))
And(-19/3 < x, x < 7/3)

sympy.solvers.inequalities.reduce_abs_inequalities(exprs, gen, assume=True)[source]

Reduce a system of inequalities with nested absolute values.

Examples

>>> from sympy import Q, Abs
>>> from sympy.abc import x
>>> from sympy.solvers.inequalities import reduce_abs_inequalities

>>> reduce_abs_inequalities([(Abs(3*x - 5) - 7, '<'),
... (Abs(x + 25) - 13, '>')], x, assume=Q.real(x))
And(-2/3 < x, Or(x < -38, x > -12), x < 4)

>>> reduce_abs_inequalities([(Abs(x - 4) + Abs(3*x - 5) - 7, '<')], x,
... assume=Q.real(x))
And(1/2 < x, x < 4)

sympy.solvers.inequalities.reduce_inequalities(inequalities, assume=True, symbols=[])[source]

Reduce a system of inequalities with rational coefficients.

Examples

>>> from sympy import Q, sympify as S
>>> from sympy.abc import x, y
>>> from sympy.solvers.inequalities import reduce_inequalities

>>> reduce_inequalities(S(0) <= x + 3, Q.real(x), [])
x >= -3

>>> reduce_inequalities(S(0) <= x + y*2 - 1, True, [x])
-2*y + 1 <= x

sympy.solvers.inequalities.solve_univariate_inequality(expr, gen, assume=True, relational=True)[source]

Solves a real univariate inequality.

Examples

>>> from sympy.solvers.inequalities import solve_univariate_inequality
>>> from sympy.core.symbol import Symbol
>>> x = Symbol('x', real=True)

>>> solve_univariate_inequality(x**2 >= 4, x)
Or(x <= -2, x >= 2)
>>> solve_univariate_inequality(x**2 >= 4, x, relational=False)
(-oo, -2] U [2, oo)


Diophantine

Tensor Module