Ask Your Question

# How to use SymmetricGroup() to input an element in Sn

I want to input an element of Sn with SymmetricGroup(),for example, I know SymmetricGroup(5)((1,2,3))is the element (1,2,3)in S5,however, I do not know how to input something like (1,2)(3,4) using SymmetricGroup()

edit retag close merge delete

## 2 Answers

Sort by ยป oldest newest most voted

Tuples look the most natural solution to me

sage: S5 = SymmetricGroup(5)
sage: S5([(1,2), (3,4)])
(1,2)(3,4)


(and you can also use strings as suggested by Samuel).

more

Just 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)

more

## Your Answer

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

Add Answer

## Stats

Asked: 2014-07-17 13:44:24 +0200

Seen: 116 times

Last updated: Jul 17 '14