def gruntz(e, z, z0, dir='+'):
 if (not z.is_Symbol):
  raise NotImplementedError('Second argument must be a Symbol')
 r = None
 if (z0 == oo):
  r = limitinf(e, z)
 elif (z0 == (- oo)):
  r = limitinf(e.subs(z, (- z)), z)
 else:
  if (str(dir) == '-'):
   e0 = e.subs(z, (z0 - (1 / z)))
  elif (str(dir) == '+'):
   e0 = e.subs(z, (z0 + (1 / z)))
  else:
   raise NotImplementedError("dir must be '+' or '-'")
  r = limitinf(e0, z)
 return r.rewrite('intractable', deep=True)

def gruntz ( e , z , z0 , dir = '+' ) : if ( not z . is_Symbol ) : raise NotImplementedError ( 'Second argument must be a Symbol' ) r = None if ( z0 == oo ) : r = limitinf ( e , z ) elif ( z0 == ( - oo ) ) : r = limitinf ( e . subs ( z , ( - z ) ) , z ) else : if ( str ( dir ) == '-' ) : e0 = e . subs ( z , ( z0 - ( 1 / z ) ) ) elif ( str ( dir ) == '+' ) : e0 = e . subs ( z , ( z0 + ( 1 / z ) ) ) else : raise NotImplementedError ( "dir must be '+' or '-'" ) r = limitinf ( e0 , z ) return r . rewrite ( 'intractable' , deep = True )
compute the limit of e(z) at the point z0 using the gruntz algorithm .