sage: P = Permutation([1,2,3,4,5])
sage: P^2
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for ** or pow():
'Permutation_class' and 'int'
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
If you're bringing up that method, I feel obligated to point out
http://trac.sagemath.org/sage_trac/ticket/2215
Jason
I have some questions about semantics and typographics convention in :
1/ Permutation
2/ PermutationGroupElement
3/ permutations (with lower p)
4/ Permutations
Suppose I don't know Sage. How can I imagine the design of each function ?
What is the first (question or) answer I must get ?
I suppose it's to know if I create a new object ?
Permutations and PermutationGroupElement have almost the same name but
type and parent are different.
Is it two implementation of the same S(n) group ?
I'm a bit confusing because I feel I ignore Sage rules.
F.
> I have some questions about semantics and typographics convention in :
>
> 1/ Permutation
> 2/ PermutationGroupElement
> 3/ permutations (with lower p)
> 4/ Permutations
>
> Suppose I don't know Sage. How can I imagine the design of each function ?
> What is the first (question or) answer I must get ?
> I suppose it's to know if I create a new object ?
>
> Permutations and PermutationGroupElement have almost the same name
> but type and parent are different.
First of all in my opinion 3/ should be deprecated. The same effect could be
achieved using Permutations:
sage: Permutations([1,1,2,2,2]).list() == permutations([1,1,2,2,2])
True
The convention is that creating an object goes through a so-called
constructor of a class and should be capitalized. Moreover the code says:
def permutations(mset):
from sage.combinat.permutation import Permutations
ans = Permutations(mset)
return ans.list()
Maybe it is also to ensure a compatibility with M* but I think it is more
confusing that anything else.
1/ vs. 4/ is the standard usage is combinatorics: Permutations() is the set of
all permutations, Permutations([1,2,3,4]) is the *set* of the permutations of
[1,2,3,4] whereas Permutation([1,2,3,4]) is the permutation [1,2,3,4]. This is
a rather well followed usage in combinatorics: Partitions vs Partition /
DyckWords vs DyckWord, BinaryTrees vs BinaryTree... etc.
1/ vs 2/ a Permutation is a combinatorial data structure which is not
necessarily seen as an element of a group. It could be for example an ordering
of a set. On the contrary, PermutationGroupElement is an element of a
permutation Group.
I hope this helps
Cheers,
Florent