partition



That's exactly what I need! ... so, I tried to extract the values of
the set but I don't know the type of the result set variable, e.g.
I require  to assign the element "2": first element of the second "row" in:  

    Barton> (%i2) A:integer_partitions(4); 
    Barton> (%o2) {[1,1,1,1],["2",1,1],[2,2],[3,1],[4]}

to variable B

B:A[2,1] ????

But is A a matrix, an array, a list ? how can I extract its
components.

Regards,
alexandre










>>>>> "Barton" == Barton Willis  writes:

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

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

    Barton> Yes:

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

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

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

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

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

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


    Barton> Barton



-- 
     "But the wisdom that is from above is first pure, then 
      peaceable, gentle, and easy to be intreated, full of 
      mercy and good fruits, without partiality, and without
      hypocrisy."     James 3:17