(self, x)
Stub that should be overridden by new Functions to return
        the first non-zero term in a series if ever an x-dependent
        argument whose leading term vanishes as x -> 0 might be encountered.
        See, for example, cos._eval_as_leading_term.
Stub that should be overridden by new Functions to return
        the first non-zero term in a series if ever an x-dependent
        argument whose leading term vanishes as x -> 0 might be encountered.
        See, for example, cos._eval_as_leading_term.
Stub that should be overridden by new Functions to return the first non - zero term in a series if ever an x - dependent argument whose leading term vanishes as x - > 0 might be encountered . See for example cos . _eval_as_leading_term .
def _eval_as_leading_term(self, x):
        """Stub that should be overridden by new Functions to return
        the first non-zero term in a series if ever an x-dependent
        argument whose leading term vanishes as x -> 0 might be encountered.
        See, for example, cos._eval_as_leading_term.
        """
        args = [a.as_leading_term(x) for a in self.args]
        o = C.Order(1, x)
        if any(x in a.free_symbols and o.contains(a) for a in args):
            # Whereas x and any finite number are contained in O(1, x),
            # expressions like 1/x are not. If any arg simplified to a
            # vanishing expression as x -> 0 (like x or x**2, but not
            # 3, 1/x, etc...) then the _eval_as_leading_term is needed
            # to supply the first non-zero term of the series,
            #
            # e.g. expression    leading term
            #      ----------    ------------
            #      cos(1/x)      cos(1/x)
            #      cos(cos(x))   cos(1)
            #      cos(x)        1        <- _eval_as_leading_term needed
            #      sin(x)        x        <- _eval_as_leading_term needed
            #
            raise NotImplementedError(
                '%s has no _eval_as_leading_term routine' % self.func)
        else:
            return self.func(*args)
def _eval_as_leading_term ( self , x ) : args = [ a . as_leading_term ( x ) for a in self . args ] o = C . Order ( 1 , x ) if any ( x in a . free_symbols and o . contains ( a ) for a in args ) : # Whereas x and any finite number are contained in O(1, x), # expressions like 1/x are not. If any arg simplified to a # vanishing expression as x -> 0 (like x or x**2, but not # 3, 1/x, etc...) then the _eval_as_leading_term is needed # to supply the first non-zero term of the series, # # e.g. expression    leading term #      ----------    ------------ #      cos(1/x)      cos(1/x) #      cos(cos(x))   cos(1) #      cos(x)        1        <- _eval_as_leading_term needed #      sin(x)        x        <- _eval_as_leading_term needed # raise NotImplementedError ( '%s has no _eval_as_leading_term routine' % self . func ) else : return self . func ( * args )