# How to create a group action table with Mathematica?

Background: I want to explain the Sylow Theorems as detailed as possible, therefore I am rewriting the proof using concrete examples.

Since the answers to my questions ( about Mathematica ) have often, if not always, exceeded my expectations, and I lack the tools to adequately show a table, I start with a compact description of my question. I can elaborate if required, of course.

Question:

Is it possible to create a group action table with Mathematica?

For example:

Let $G = \left\{ 1,a,a^2, b, ba, ba^2 \right \}$, where $a^3=b^2=1, ab=ba^2 (D3)$ .

Let $S$ be the set of subsets of size $3$ of $G$: $\left\{ \left\{ 1,a,a^2 \right \}, \left\{1,a,b \right \}, ..., \left\{b,ba,ba^2 \right \} \right \}$ .

Define the map $f: G \times S \rightarrow S \$ by $(g,s) \mapsto gs$.

The group action table, illustrating the map $f$ would be of size 20 X 6 with each cell containing an element of $S$.

I have ( experience with ) the Mathematica AbstractAlgebra package. I'll accept answers in GAP also.

-
Tables work fine in MathJax, but you need to end a line with \\ (double backslash), as I showed you in the answer to your meta question I have removed the MathJax experimentation from your post, as it was not connected to the question. Can you post the table you meant to post? – Szabolcs Jan 27 '12 at 13:51
@ziyuang - Permuting what ? – nilo de roock Jan 27 '12 at 14:34
@Szabolcs - I am doing two group action tables in Excel and learning about group actions in GAP. Will post image when done. Probably tomorrow. – nilo de roock Jan 27 '12 at 14:36
@Szabolcs - Click. I got it about the LaTeX tables now. – nilo de roock Jan 27 '12 at 14:37

## 2 Answers

MMA v.8 provides support for (finite) Group Theory, however this answer will not make use of that functionality.

We shall use the ** (NonCommutativeMultiply) command present in MMA, which allows us to create semigroups quite easily.

In a fresh MMA session:

Unprotect[NonCommutativeMultiply];

GroupAction[g_, s_] := (g ** #) & /@ s

1 is the identity:

g_ ** 1 := g

1 ** g_ := g

Elements relations

a ** a ** a := 1

b ** b := 1

b ** a ** a := a ** b

Then

G = {1, a, a ** a, b, b ** a, b ** a ** a}

S = Subsets[G, {3}]

Check some products:

a ** 1 ** b ** q

a ** 1 ** b ** b ** q

a ** 1 ** b ** a ** a ** b ** q

p ** a ** a ** a ** q

(p and q are generic group elemants) as you see MMA uses the associative (Flat) property of NonCommutativeMultiply to parse and simplify the expressions in all possible ways. Now this is your table:

Table[GroupAction[g, s], {s, S}, {g, G}] // MatrixForm

Nicely formatted:

Grid[Prepend[Table[GroupAction[g, s], {s, S}, {g, G}], G], Background -> {None, {Lighter[Blue, .9], {White, Lighter[Blend[{Blue, Green}], .8]}}}]

If you are serious about Group Theory, you might want to check the functionalities offered by MMA v.8

-
I can make another answer - tomorrow - using the Group theory functions in MMA v.8 if you are interested. – magma Jan 27 '12 at 18:43
Do you know why is a seemingly inert (and unused by the system) symbol like NonCommutativeMultiply protected? – Szabolcs Jan 27 '12 at 20:12
One might sometimes prefer Outer[] to Table[] for generating the Cayley table of a binary operation... – J. M. Jan 28 '12 at 0:08
I know that GAP is the tool for Group Theory, but GAP has quite a learning curve. Although not a cross-poster I asked in the Mathematica section. See: math.stackexchange.com/questions/103220/… This basically works for any group and subset size. - I have invested a lot in learning Mathematica but it can handle very limited functionality in Group Theory. Developing a parser to and from GAP from Mathematica is on my list. They did it for SAGE, it can be done. – nilo de roock Jan 30 '12 at 11:35
Will test the answer later. NonCommutativeMultiply is new for me. Thanks. – nilo de roock Jan 30 '12 at 11:36

Not very elegant and it requires additional work on the rules :

elem = {1, a, b}
rules = {a^3 -> 1, a^4 -> a, b^2 -> 1, b^3 -> b, b a^2 -> a b, b^4 -> 1}
bigG = Union[Times @@ # & /@ Tuples[elem, {2}]]
bigS = Subsets[bigG, {3}]
TableView[
Outer[Sort[#1 #2 //. rules] &, bigG, bigS, 1, 1],
TableHeadings -> {bigG, bigS}
]

-
This does not work correctly, since the multiplication in D3 is not commutative, while Times is commutative. You would get wrong results using this table. – magma Jan 27 '12 at 18:30
@magma Thanks for the clarification. I am not familiar with this group and it was not specified in the question that the multiplication is non-commutative. – b.gatessucks Jan 27 '12 at 19:43
Instead of the undocumented (and here practically unnecessary) TableView, you can consider MatrixForm[ ... , TableDepth -> 2]. – Szabolcs Jan 27 '12 at 22:49
@b.gatessucks $ab=ba^3$ means non-commutative. – nilo de roock Feb 18 '12 at 21:54
@ndroock1 Thanks for the clarification. – b.gatessucks Feb 18 '12 at 22:52