Ebrahimi
Ebrahimi

Reputation: 1239

converting Permutation to list in sage 6.2 and count some list

I try to count a list in a permutation :

w = Permutations([])
w = w.list()
w.count([])

the output of last line w.count([]) in sage 6.2 is 0 but in sage 5.0 is 1

my question is, why this is happen????

i think the correct for that is 1

Upvotes: 0

Views: 155

Answers (1)

fidbc
fidbc

Reputation: 186

It could be the case that way permutations are represented changed. You can see that the following commands have different outputs.

print type([])
print type(w[0])

In order to count the number of occurrences of the permutation [] you can begin by converting it to a Permutation. The following should do the job.

P = Permutations([])
elems = P.list()
elems.count(P([]))

Upvotes: 2

Related Questions