partition



-----maxima-admin@math.utexas.edu wrote: -----

>Is there something in Maxima to get the "partition" of an integer n in m
parts,

Yes:

(%i1) load(nset)$
(%i2) integer_partitions(4);
(%o2) {[1,1,1,1],[2,1,1],[2,2],[3,1],[4]}

To find the partitions with length m or less, use a second argument of m

(%i3) integer_partitions(4,2);
(%o3) {[2,2],[3,1],[4,0]}

If you want partitions with exactly m numbers, you can try this:

(%i4) subset(integer_partitions(4,2), lambda([s], not member(0,s)));
(%o4) {[2,2],[3,1]}

If you have Maxima 5.9.1, you'll need to download nset from
http://www.unk.edu/facstaff/profiles/willisb/; if you have
Maxima 5.9.1cvs, you all ready have nset.


Barton