Ask Your Question
0

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

asked 2014-07-17 13:44:24 +0100

ruidongshuai@gmail.com gravatar image

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

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-07-17 16:15:05 +0100

vdelecroix gravatar image

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

edit flag offensive delete link more
1

answered 2014-07-17 13:48:37 +0100

slelievre gravatar image

updated 2014-07-17 13:56:27 +0100

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)
edit flag offensive delete link more

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: 2014-07-17 13:44:24 +0100

Seen: 295 times

Last updated: Jul 17 '14