def as_set(self): """ Rewrite logic operators and relationals in terms of real sets. Examples ======== >>> from sympy import And, Symbol >>> x = Symbol('x', real=True) >>> And(x<2, x>-2).as_set() (-2, 2) """ from sympy.core.sets import Intersection if len(self.free_symbols) == 1: return Intersection(*[arg.as_set() for arg in self.args]) else: raise NotImplementedError("Sorry, And.as_set has not yet been" " implemented for multivariate" " expressions")
def _intersect(self, other): if other.is_Interval: return Intersection(S.Integers, other, Interval(1, oo)) return None
def _intersect(self, other): if other.is_Interval: return Intersection(S.Integers, other, Interval(self._inf, S.Infinity)) return None