This is indeed a bug! Thanks for the report.

The thing is that the code for cardinality (before the call to .list()) is inherited from permutations without a fixed length. The (wrong) number you got (1680) is actually the number of permutations without length restriction.

See

   http://trac.sagemath.org/ticket/20317

By the way you would better use Permutations(ms, 3) rather than importing Permutations_msetk.

Vincent

On 29/03/16 09:41, Karol Suchan wrote:
Hi,

I've spotted a strange behaviour of Permutations.cardinality(): first it
reports a weird number, but after a call to list() it gets ok. Any reason
why?

I copy a code that compares the behaviour of Tuples, Permutations and
Arrangements.

%%%%%%%%%%%%%%%
from sage.combinat.permutation import *
from sage.combinat.tuple import *

ms=[1,1,1,2,2,2,3,3,3]

tms = Tuples(ms,3)
pms = Permutations_msetk(ms,3)
ams = Arrangements_msetk(ms,3)

print("ctms: " + str(tms.cardinality()))
print("cpms: " + str(pms.cardinality()))
print("cams: " + str(ams.cardinality()))

print("ltms: " + str(tms.list()))
print("lpms: " + str(pms.list()))
print("lams: " + str(ams.list()))

print("ctms: " + str(tms.cardinality()))
print("cpms: " + str(pms.cardinality()))
print("cams: " + str(ams.cardinality()))
%%%%%%%%%%%%%%%

Best,
Karol


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to