@public
def assemble_partfrac_list(partial_list):
 common = partial_list[0]
 polypart = partial_list[1]
 pfd = polypart.as_expr()
 for (r, nf, df, ex) in partial_list[2]:
  if isinstance(r, Poly):
   (an, nu) = (nf.variables, nf.expr)
   (ad, de) = (df.variables, df.expr)
   de = de.subs(ad[0], an[0])
   func = Lambda(an, (nu / (de ** ex)))
   pfd += RootSum(r, func, auto=False, quadratic=False)
  else:
   for root in r:
    pfd += (nf(root) / (df(root) ** ex))
 return (common * pfd)

@ public def assemble_partfrac_list ( partial_list ) : common = partial_list [ 0 ] polypart = partial_list [ 1 ] pfd = polypart . as_expr ( ) for ( r , nf , df , ex ) in partial_list [ 2 ] : if isinstance ( r , Poly ) : ( an , nu ) = ( nf . variables , nf . expr ) ( ad , de ) = ( df . variables , df . expr ) de = de . subs ( ad [ 0 ] , an [ 0 ] ) func = Lambda ( an , ( nu / ( de ** ex ) ) ) pfd += RootSum ( r , func , auto = False , quadratic = False ) else : for root in r : pfd += ( nf ( root ) / ( df ( root ) ** ex ) ) return ( common * pfd )
reassemble a full partial fraction decomposition from a structured result obtained by the function apart_list .