@public
def apart_list(f, x=None, dummies=None, **options):
 allowed_flags(options, [])
 f = sympify(f)
 if f.is_Atom:
  return f
 else:
  (P, Q) = f.as_numer_denom()
 options = set_defaults(options, extension=True)
 ((P, Q), opt) = parallel_poly_from_expr((P, Q), x, **options)
 if P.is_multivariate:
  raise NotImplementedError('multivariate partial fraction decomposition')
 (common, P, Q) = P.cancel(Q)
 (poly, P) = P.div(Q, auto=True)
 (P, Q) = P.rat_clear_denoms(Q)
 polypart = poly
 if (dummies is None):
  def dummies(name):
   d = Dummy(name)
   while True:
    (yield d)
  dummies = dummies('w')
 rationalpart = apart_list_full_decomposition(P, Q, dummies)
 return (common, polypart, rationalpart)

@ public def apart_list ( f , x = None , dummies = None , ** options ) : allowed_flags ( options , [ ] ) f = sympify ( f ) if f . is_Atom : return f else : ( P , Q ) = f . as_numer_denom ( ) options = set_defaults ( options , extension = True ) ( ( P , Q ) , opt ) = parallel_poly_from_expr ( ( P , Q ) , x , ** options ) if P . is_multivariate : raise NotImplementedError ( 'multivariate partial fraction decomposition' ) ( common , P , Q ) = P . cancel ( Q ) ( poly , P ) = P . div ( Q , auto = True ) ( P , Q ) = P . rat_clear_denoms ( Q ) polypart = poly if ( dummies is None ) : def dummies ( name ) : d = Dummy ( name ) while True : ( yield d ) dummies = dummies ( 'w' ) rationalpart = apart_list_full_decomposition ( P , Q , dummies ) return ( common , polypart , rationalpart )
compute partial fraction decomposition of a rational function and return the result in structured form .