(self, expr)
return self.contains(obj)
Return True if expr belongs to Order(self.expr, \*self.variables).
        Return False if self belongs to expr.
        Return None if the inclusion relation cannot be determined
        (e.g. when self and expr have different symbols).
Return True if expr belongs to Order(self.expr, \*self.variables).
        Return False if self belongs to expr.
        Return None if the inclusion relation cannot be determined
        (e.g. when self and expr have different symbols).
Return True if expr belongs to Order ( self . expr \ * self . variables ) . Return False if self belongs to expr . Return None if the inclusion relation cannot be determined ( e . g . when self and expr have different symbols ) .
def contains(self, expr):
        """
        Return True if expr belongs to Order(self.expr, \*self.variables).
        Return False if self belongs to expr.
        Return None if the inclusion relation cannot be determined
        (e.g. when self and expr have different symbols).
        """
        from sympy import powsimp, PoleError
        if expr is S.Zero:
            return True
        if expr is S.NaN:
            return False
        if expr.is_Order:
            if not all(p == expr.point[0] for p in expr.point) and \
               not all(p == self.point[0] for p in self.point):
                raise NotImplementedError('Order at points other than 0 '
                    'or oo not supported, got %s as a point.' % point)
            else:
                # self and/or expr is O(1):
                if any(not p for p in [expr.point, self.point]):
                    point = self.point + expr.point
                    if point:
                        point = point[0]
                    else:
                        point = S.Zero
                else:
                    point = self.point[0]
            if expr.expr == self.expr:
                # O(1) + O(1), O(1) + O(1, x), etc.
                return all([x in self.args[1:] for x in expr.args[1:]])
            if expr.expr.is_Add:
                return all([self.contains(x) for x in expr.expr.args])
            if self.expr.is_Add:
                return any([self.func(x, *self.args[1:]).contains(expr)
                            for x in self.expr.args])
            if self.variables and expr.variables:
                common_symbols = tuple(
                    [s for s in self.variables if s in expr.variables])
            elif self.variables:
                common_symbols = self.variables
            else:
                common_symbols = expr.variables
            if not common_symbols:
                return None
            r = None
            ratio = self.expr/expr.expr
            ratio = powsimp(ratio, deep=True, combine='exp')
            for s in common_symbols:
                try:
                    l = ratio.limit(s, point) != 0
                except PoleError:
                    l = None
                if r is None:
                    r = l
                else:
                    if r != l:
                        return
            return r
        obj = self.func(expr, *self.args[1:])
        return self.contains(obj)
def contains ( self , expr ) : from sympy import powsimp , PoleError if expr is S . Zero : return True if expr is S . NaN : return False if expr . is_Order : if not all ( p == expr . point [ 0 ] for p in expr . point ) and not all ( p == self . point [ 0 ] for p in self . point ) : raise NotImplementedError ( 'Order at points other than 0 ' 'or oo not supported, got %s as a point.' % point ) else : # self and/or expr is O(1): if any ( not p for p in [ expr . point , self . point ] ) : point = self . point + expr . point if point : point = point [ 0 ] else : point = S . Zero else : point = self . point [ 0 ] if expr . expr == self . expr : # O(1) + O(1), O(1) + O(1, x), etc. return all ( [ x in self . args [ 1 : ] for x in expr . args [ 1 : ] ] ) if expr . expr . is_Add : return all ( [ self . contains ( x ) for x in expr . expr . args ] ) if self . expr . is_Add : return any ( [ self . func ( x , * self . args [ 1 : ] ) . contains ( expr ) for x in self . expr . args ] ) if self . variables and expr . variables : common_symbols = tuple ( [ s for s in self . variables if s in expr . variables ] ) elif self . variables : common_symbols = self . variables else : common_symbols = expr . variables if not common_symbols : return None r = None ratio = self . expr / expr . expr ratio = powsimp ( ratio , deep = True , combine = 'exp' ) for s in common_symbols : try : l = ratio . limit ( s , point ) != 0 except PoleError : l = None if r is None : r = l else : if r != l : return return r obj = self . func ( expr , * self . args [ 1 : ] ) return self . contains ( obj )