def _eval_as_leading_term(self, x, logx=None, cdir=0): if len(self.args) == 1: arg = self.args[0] arg0 = arg.subs(x, 0).cancel() if not arg0.is_zero: return self.func(arg0) return arg.as_leading_term(x)
def simp_heaviside(arg): a = arg.subs(exp(-t), u) if a.has(t): return Heaviside(arg) rel = _solve_inequality(a > 0, u) if rel.lhs == u: k = log(rel.rhs) return Heaviside(t + k) else: k = log(rel.lhs) return Heaviside(-(t + k))
def _eval_as_leading_term(self, x, cdir=0): from sympy import I, im arg = self.args[0].together() x0 = arg.subs(x, 0) if x0 == 1: return (arg - S.One).as_leading_term(x) if cdir != 0: cdir = self.args[0].dir(x, cdir) if x0.is_real and x0.is_negative and im(cdir) < 0: return self.func(x0) - 2 * I * S.Pi return self.func(arg.as_leading_term(x))