Ask Your Question
2

Multiply Arbitrary Permutations

asked 2022-04-12 15:04:36 +0200

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
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-04-12 15:38:36 +0200

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]).

edit flag offensive delete link more

Comments

1

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

Thrash gravatar imageThrash ( 2022-04-12 15:50:40 +0200 )edit

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: 2022-04-12 15:04:36 +0200

Seen: 112 times

Last updated: Apr 12 '22