Ask Your Question
2

Multiply Arbitrary Permutations

asked 3 years ago

Thrash gravatar image

Is there a way to multiply arbitrary permutations?

sage: P=Permutations(var('x y z'));P
Permutations of the set [x, y, z]
sage: P[1];P[2]
[x, z, y]
[y, x, z]

But now

sage: P[1]*P[2]

gives an error:

TypeError: unsupported operand parent(s) for *: 'Permutations of the set [x, y, z]' and 'Permutations of the set [x, y, z]'

I can't even evaluate such a permutation at an element.

sage: P[1](x)

results in

TypeError: 'Permutations_set_with_category.element_class' object is not callable
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 3 years ago

rburing gravatar image

You can define the symmetric group on your set instead:

sage: P = SymmetricGroup(var('x,y,z')); P
Symmetric group of order 3! as a permutation group

The elements are displayed in cycle notation, evaluation is allowed and there is a group structure:

sage: P[2]
(x,y,z)
sage: P[2](x)
y
sage: P[2].tuple()
(y, z, x)
sage: P[3]
(y,z)
sage: P[2]*P[3]
(x,z)

Note that the product is opposite from the more usual one (here P[2]*P[3] is P[3] after P[2]).

Preview: (hide)
link

Comments

1

Thank you! Somehow I was stuck in my thought that SymmetricGroup would allow only integers.

Thrash gravatar imageThrash ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 195 times

Last updated: Apr 12 '22