Let S= {"A","B","C","D"} and S4= SymmetricGroup(4). I want to create a table of the action S4 x S -> S which standardly permutes the letters in the set. The table should look like:

Permutation.   A.  B.  C.  D
()             A.  B.  C.  D
(1 2 )         B.  A.  C.  D.

How can this be done with Sage? ( The Set and Group in the question are just examples, I want to be able to create a table for any action.

  • 1
    $\begingroup$ If you don't get answers here, you could try asking here or here. $\endgroup$ Jan 2, 2015 at 13:28
  • $\begingroup$ Thanks, I will definitely try that, I used to code a lot in Mathematica for which I have had so much excellent support here at Mathematica SE. I hoped to get some Sage support on SE but I think you are right: this might not be the place, despite the tag. I can do most of the stuff directly in GAP but I want to learn it the Sage way. Only then I can decide if Sage is what I need. $\endgroup$ Jan 2, 2015 at 13:44
  • 1
    $\begingroup$ Here is the sage-support thread groups.google.com/forum/#!topic/sage-support/20gEbPVFd_Y $\endgroup$
    – kcrisman
    Jan 2, 2015 at 15:52

1 Answer 1


Given a group $G$, an ordered set $X$ and an action $\varphi: G \times X \to X$, based on your example you want a table with rows $g, \operatorname{im} \varphi(g, \cdot)$, where the images of the elements of $X$ are computed in the given order.

We can arrange this in SAGE as follows (using your example):

G = SymmetricGroup(4)
X = ['A','B','C','D']
act = lambda g, x: X[g(X.index(x) + 1) - 1]
im = lambda g: [act(g,x) for x in X]

table([(g, im(g)) for g in G])


()           ['A', 'B', 'C', 'D']
(3,4)        ['A', 'B', 'D', 'C']
(2,3)        ['A', 'C', 'B', 'D']
(2,3,4)      ['A', 'C', 'D', 'B']
(2,4,3)      ['A', 'D', 'B', 'C']
(2,4)        ['A', 'D', 'C', 'B']
(1,2)        ['B', 'A', 'C', 'D']
(1,2)(3,4)   ['B', 'A', 'D', 'C']
(1,2,3)      ['B', 'C', 'A', 'D']
(1,2,3,4)    ['B', 'C', 'D', 'A']
(1,2,4,3)    ['B', 'D', 'A', 'C']
(1,2,4)      ['B', 'D', 'C', 'A']
(1,3,2)      ['C', 'A', 'B', 'D']
(1,3,4,2)    ['C', 'A', 'D', 'B']
(1,3)        ['C', 'B', 'A', 'D']
(1,3,4)      ['C', 'B', 'D', 'A']
(1,3)(2,4)   ['C', 'D', 'A', 'B']
(1,3,2,4)    ['C', 'D', 'B', 'A']
(1,4,3,2)    ['D', 'A', 'B', 'C']
(1,4,2)      ['D', 'A', 'C', 'B']
(1,4,3)      ['D', 'B', 'A', 'C']
(1,4)        ['D', 'B', 'C', 'A']
(1,4,2,3)    ['D', 'C', 'A', 'B']
(1,4)(2,3)   ['D', 'C', 'B', 'A']

The row with the identity element conveniently serves as a heading.

Clearly hardest part of this is to define the action.

  • 1
    $\begingroup$ ( Dank je wel Ricardo) Thanks, it is the answer I was looking for. $\endgroup$ Jan 2, 2015 at 17:41
  • $\begingroup$ Damn!! I was looking for it everywhere. $\endgroup$
    – S L
    Sep 8, 2016 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .