"Mike Hansen" <mhan...@gmail.com> writes: > Hello, > > On Sun, Dec 14, 2008 at 4:04 PM, green351 <mmamashra...@gmail.com> wrote: > > > > Hi, > > This is my first time emailing with a question and my first time > > trying to use Sage (I'm a complete programming dunce). I'm trying to > > do the following: > > Given the tuple (p,q) in Z x Z and integer n I need to count the > > number of integer-tuple solutions to the following > > (p,q)=(a_1,b_1)+...+(a_n,b_n) subject to the following conditions > > - (a_i,b_i) \neq (a_j,b_j) for i, j different > > - a_i, b_i >= -1 > > - a_i+b_i > 0 > > What you're trying to count is the number of multiset partitions. I > haven't written any code to do this in Sage, but I've been meaning > too. So now is a good time to start :-) > > For an interesting reference on this is Knuth's Art of Computer > Programming Volume 4, Fascicle 3 (b). Using the formula found in > http://www.emis.de/journals/HOA/IJMMS/22/1213.pdf , we get the > following bit of Sage code
if you check out aldor combinat, the iso-experiment branch via svn://svn.risc.uni-linz.ac.at/hemmecke/combinat/branches you will find a literal implementation of Knuth's algorithm (with correction :-)). Please ask if you are interested in further directions. Martin --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---