(inequalities, assume=True, symbols=[])
return And(*(poly_reduced + abs_reduced))
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
Reduce a system of inequalities with rational coefficients.
Reduce a system of inequalities with rational coefficients .
def reduce_inequalities(inequalities, assume=True, symbols=[]):
    """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
    """
    if not hasattr(inequalities, '__iter__'):
        inequalities = [inequalities]

    if len(inequalities) == 1 and len(symbols) == 1 \
            and inequalities[0].is_Relational:
        try:
            return _solve_inequality(inequalities[0], symbols[0],
                assume=assume)
        except NotImplementedError:
            pass

    poly_part, abs_part, extra_assume = {}, {}, []

    for inequality in inequalities:
        if inequality == True:
            continue
        elif inequality == False:
            return False

        if isinstance(inequality, AppliedPredicate):
            extra_assume.append(inequality)
            continue

        if inequality.is_Relational:
            expr, rel = inequality.lhs - inequality.rhs, inequality.rel_op
        else:
            expr, rel = inequality, '=='

        gens = expr.free_symbols

        if not gens:
            return False
        elif len(gens) == 1:
            gen = gens.pop()
        else:
            raise NotImplementedError(
                "only univariate inequalities are supported")

        components = expr.find(lambda u: u.is_Function)

        if not components:
            if gen in poly_part:
                poly_part[gen].append((expr, rel))
            else:
                poly_part[gen] = [(expr, rel)]
        else:
            if all(isinstance(comp, Abs) for comp in components):
                if gen in abs_part:
                    abs_part[gen].append((expr, rel))
                else:
                    abs_part[gen] = [(expr, rel)]
            else:
                raise NotImplementedError("can't reduce %s" % inequalities)

    extra_assume = And(*extra_assume)

    if assume is not None:
        assume = And(assume, extra_assume)
    else:
        assume = extra_assume

    poly_reduced = []
    abs_reduced = []

    for gen, exprs in poly_part.items():
        poly_reduced.append(reduce_rational_inequalities([exprs], gen, assume))

    for gen, exprs in abs_part.items():
        abs_reduced.append(reduce_abs_inequalities(exprs, gen, assume))

    return And(*(poly_reduced + abs_reduced))
def reduce_inequalities ( inequalities , assume = True , symbols = [ ] ) : if not hasattr ( inequalities , '__iter__' ) : inequalities = [ inequalities ] if len ( inequalities ) == 1 and len ( symbols ) == 1 and inequalities [ 0 ] . is_Relational : try : return _solve_inequality ( inequalities [ 0 ] , symbols [ 0 ] , assume = assume ) except NotImplementedError : pass poly_part , abs_part , extra_assume = { } , { } , [ ] for inequality in inequalities : if inequality == True : continue elif inequality == False : return False if isinstance ( inequality , AppliedPredicate ) : extra_assume . append ( inequality ) continue if inequality . is_Relational : expr , rel = inequality . lhs - inequality . rhs , inequality . rel_op else : expr , rel = inequality , '==' gens = expr . free_symbols if not gens : return False elif len ( gens ) == 1 : gen = gens . pop ( ) else : raise NotImplementedError ( "only univariate inequalities are supported" ) components = expr . find ( lambda u : u . is_Function ) if not components : if gen in poly_part : poly_part [ gen ] . append ( ( expr , rel ) ) else : poly_part [ gen ] = [ ( expr , rel ) ] else : if all ( isinstance ( comp , Abs ) for comp in components ) : if gen in abs_part : abs_part [ gen ] . append ( ( expr , rel ) ) else : abs_part [ gen ] = [ ( expr , rel ) ] else : raise NotImplementedError ( "can't reduce %s" % inequalities ) extra_assume = And ( * extra_assume ) if assume is not None : assume = And ( assume , extra_assume ) else : assume = extra_assume poly_reduced = [ ] abs_reduced = [ ] for gen , exprs in poly_part . items ( ) : poly_reduced . append ( reduce_rational_inequalities ( [ exprs ] , gen , assume ) ) for gen , exprs in abs_part . items ( ) : abs_reduced . append ( reduce_abs_inequalities ( exprs , gen , assume ) ) return And ( * ( poly_reduced + abs_reduced ) )