Ask Your Question

Revision history [back]

Just use a string.

sage: SymmetricGroup(5)('(1,2)(3,4)')
(1,2)(3,4)

Just use input the argument as a string.

sage: SymmetricGroup(5)('(1,2)(3,4)')
(1,2)(3,4)

If you want to use permutations on 0, 1, 2, 3, 4 instead of permutations on 1, 2, 3, 4, 5, you can do this:

sage: S = SymmetricGroup([0,1,2,3,4])
sage: S
Symmetric group of order 5! as a permutation group
sage: S('(0,1)(2,3)')
(0,1)(2,3)

or, better, this:

sage: S = SymmetricGroup(range(5))
sage: S
Symmetric group of order 5! as a permutation group
sage: S('(0,1)(2,3)')
(0,1)(2,3)