@debug
@timeit
@cacheit
def limitinf(e, x):
 e = e.rewrite('tractable', deep=True)
 if (not e.has(x)):
  return e
 if e.has(Order):
  e = e.expand().removeO()
 if (not x.is_positive):
  p = Dummy('p', positive=True, finite=True)
  e = e.subs(x, p)
  x = p
 (c0, e0) = mrv_leadterm(e, x)
 sig = sign(e0, x)
 if (sig == 1):
  return S.Zero
 elif (sig == (-1)):
  if c0.match((I * Wild('a', exclude=[I]))):
   return (c0 * oo)
  s = sign(c0, x)
  if (s == 0):
   raise ValueError('Leading term should not be 0')
  return (s * oo)
 elif (sig == 0):
  return limitinf(c0, x)

@ debug @ timeit @ cacheit def limitinf ( e , x ) : e = e . rewrite ( 'tractable' , deep = True ) if ( not e . has ( x ) ) : return e if e . has ( Order ) : e = e . expand ( ) . removeO ( ) if ( not x . is_positive ) : p = Dummy ( 'p' , positive = True , finite = True ) e = e . subs ( x , p ) x = p ( c0 , e0 ) = mrv_leadterm ( e , x ) sig = sign ( e0 , x ) if ( sig == 1 ) : return S . Zero elif ( sig == ( - 1 ) ) : if c0 . match ( ( I * Wild ( 'a' , exclude = [ I ] ) ) ) : return ( c0 * oo ) s = sign ( c0 , x ) if ( s == 0 ) : raise ValueError ( 'Leading term should not be 0' ) return ( s * oo ) elif ( sig == 0 ) : return limitinf ( c0 , x )
limit e(x) for x-> oo .