Looking at the code, the cardinality() is done sensibly for IntegerVectors_nkconstraints, but not for IntegerVectors_nk, which is what will be used by default. It should be a simple patch (I can do it if no-one else wants to) - as the code is essentially already there in IntegerVectors_nkconstraints.
Emil On 18 May 2012 08:42, David Loeffler <d.a.loeff...@warwick.ac.uk> wrote: > The size of this set is the binomial coefficient (m + n - 1) choose ( n - 1 ). > > David > > On 17 May 2012 14:26, Martin Albrecht <martinralbre...@googlemail.com> wrote: >> Hi, >> >> currently when running e.g. >> >> sage: IV53 = IntegerVectors(5,3) # length 3 vectors that sum to 5 >> sage: IV53.cardinality() >> >> The algorithm is simply to enumerate all elements (which is the default >> algorithm). My question is: is that because that's the best we can do, or >> just because nobody sat down and implemented the correct formula (i.e., is it >> known)? >> >> If an exact formula is not know, does anyone know an upper bound (somewhat >> tight :))? >> >> Cheers, >> Martin >> >> -- >> name: Martin Albrecht >> _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 >> _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF >> _www: http://martinralbrecht.wordpress.com/ >> _jab: martinralbre...@jabber.ccc.de >> >> -- >> 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 >> URL: http://www.sagemath.org > > -- > 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 > URL: http://www.sagemath.org -- 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 URL: http://www.sagemath.org