def solve_rational_inequalities(eqs):
 result = S.EmptySet
 for _eqs in eqs:
  if (not _eqs):
   continue
  global_intervals = [Interval(S.NegativeInfinity, S.Infinity)]
  for ((numer, denom), rel) in _eqs:
   numer_intervals = solve_poly_inequality((numer * denom), rel)
   denom_intervals = solve_poly_inequality(denom, '==')
   intervals = []
   for numer_interval in numer_intervals:
    for global_interval in global_intervals:
     interval = numer_interval.intersect(global_interval)
     if (interval is not S.EmptySet):
      intervals.append(interval)
   global_intervals = intervals
   intervals = []
   for global_interval in global_intervals:
    for denom_interval in denom_intervals:
     global_interval -= denom_interval
    if (global_interval is not S.EmptySet):
     intervals.append(global_interval)
   global_intervals = intervals
   if (not global_intervals):
    break
  for interval in global_intervals:
   result = result.union(interval)
 return result

def solve_rational_inequalities ( eqs ) : result = S . EmptySet for _eqs in eqs : if ( not _eqs ) : continue global_intervals = [ Interval ( S . NegativeInfinity , S . Infinity ) ] for ( ( numer , denom ) , rel ) in _eqs : numer_intervals = solve_poly_inequality ( ( numer * denom ) , rel ) denom_intervals = solve_poly_inequality ( denom , '==' ) intervals = [ ] for numer_interval in numer_intervals : for global_interval in global_intervals : interval = numer_interval . intersect ( global_interval ) if ( interval is not S . EmptySet ) : intervals . append ( interval ) global_intervals = intervals intervals = [ ] for global_interval in global_intervals : for denom_interval in denom_intervals : global_interval -= denom_interval if ( global_interval is not S . EmptySet ) : intervals . append ( global_interval ) global_intervals = intervals if ( not global_intervals ) : break for interval in global_intervals : result = result . union ( interval ) return result
solve a system of rational inequalities with rational coefficients .