def hyperexpand(f, allow_hyper=False, rewrite='default', place=None):
 f = sympify(f)
 def do_replace(ap, bq, z):
  r = _hyperexpand(Hyper_Function(ap, bq), z, rewrite=rewrite)
  if (r is None):
   return hyper(ap, bq, z)
  else:
   return r
 def do_meijer(ap, bq, z):
  r = _meijergexpand(G_Function(ap[0], ap[1], bq[0], bq[1]), z, allow_hyper, rewrite=rewrite, place=place)
  if (not r.has(nan, zoo, oo, (- oo))):
   return r
 return f.replace(hyper, do_replace).replace(meijerg, do_meijer)

def hyperexpand ( f , allow_hyper = False , rewrite = 'default' , place = None ) : f = sympify ( f ) def do_replace ( ap , bq , z ) : r = _hyperexpand ( Hyper_Function ( ap , bq ) , z , rewrite = rewrite ) if ( r is None ) : return hyper ( ap , bq , z ) else : return r def do_meijer ( ap , bq , z ) : r = _meijergexpand ( G_Function ( ap [ 0 ] , ap [ 1 ] , bq [ 0 ] , bq [ 1 ] ) , z , allow_hyper , rewrite = rewrite , place = place ) if ( not r . has ( nan , zoo , oo , ( - oo ) ) ) : return r return f . replace ( hyper , do_replace ) . replace ( meijerg , do_meijer )
expand hypergeometric functions .