FW: Series( 1/f[z] ) and partitions

Wouter Meeussen w.meeussen.vdmcc at vandemoortele.be
Fri Aug 11 13:44:59 CEST 2000


dear all,

A combinatorial trick to write Series( 1/f[z] ) upto n terms. It is of course mucho faster 
than making your symbolic processor grind through the nestings of (1/f)' -> (f - f')/f^2.

CoefficientList[Series[1/ f[z],{z,0,12}],z];
it=Simplify[% /. Derivative[k_][f][0]:>f[k]];

"it" still contains all the goodies, with notation f[k] for the k'th derivative of f[z] taken at z->0.
Now we prep it into a fraction-free form using the EGF- extraction trick:

prep=  Expand[  it Range[0,12]! f[0]^Range[1+12] ] ;

Here comes my result : prep equals :

Table[Plus@@( Apply[  f[0]^(n-Length[ {##}]) Multinomial[##]multiplicity[{##}]((-f[#]&)/@w[  ##  ])&,
          Reverse at Partitions[n],{1}]/.w->Times),{n,0,12}]

(isn't she cute?)
where the impression of a "one-liner"  is severely spoiled by the need for a "multiplicity" function (deja-vu!)
   multiplicity[alist:{Integer__}]:=Apply[Multinomial,Length/@Split[Sort[alist]]];
   multiplicity[{}]:=1
We also need DiscreteMath`Combinatorica` for the Partitions  generator.

There. If you want to grok the one-liner, just take apart the fat thing into 
Table[  ( Apply[  f[0]^(n-Length[ {##}])                        &,Reverse at Partitions[n],{1}]/.w->Times),{n,0,7}]
Table[  ( Apply[             Multinomial[##]                    &,Reverse at Partitions[n],{1}]/.w->Times),{n,0,7}]
Table[  ( Apply[                  multiplicity[{##}]            &,Reverse at Partitions[n],{1}]/.w->Times),{n,0,7}]
Table[  ( Apply[                          ((-f[#]&)/@w[  ##  ]) &,Reverse at Partitions[n],{1}]/.w->Times),{n,0,7}]

have a happy ascention

wouter




Wouter Meeussen
tel +32 (0)51 33 21 24
fax +32 (0)51 33 21 75
wouter.meeussen at vandemoortele.com







More information about the SeqFan mailing list