I find the OP questions somewhat unclear. In any case, the answers can be found in the tutorials "Permutations" and
"Permutation Groups".
I would like to permute the elements of the set A using symmetric
group.
In[44]:= Permute[{1,2,3},SymmetricGroup[3]]
Out[44]= {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}
The Mathematica equivalent of the Sage code:
G = SymmetricGroup(3)
for i in G: print [j*i*j^(-1) for j in G]
should be written with other operators/functions, otherwise j*i*j^(-1)
will simplify to i
. Here I use NonCommutativeMultiply
and Inverse
:
In[42]:= Permute[NonCommutativeMultiply[j, i, Inverse[j]], SymmetricGroup[3]]
Out[42]= {j ** i ** Inverse[j], j ** Inverse[j] ** i,
i ** j ** Inverse[j], i ** Inverse[j] ** j, Inverse[j] ** j ** i,
Inverse[j] ** i ** j}
Furthermore, I would like find the elements of $S_3$ that leaves the
set $A=\{1,2\}$ invariant [...]
This is unclear to me because:
In[47]:= GroupStabilizer[SymmetricGroup[3], {1, 2}]
Out[47]= PermutationGroup[{}]
hence
In[36]:= Permute[{1,2,3}, GroupStabilizer[SymmetricGroup[3], {1, 2}]]
Out[36]= {{}}
May be the following examples are helpful illustrations.
Fixing the 3d element using $S_3$:
In[50]:= Permute[Range[3], GroupStabilizer[SymmetricGroup[3], {3}]]
Out[50]= {{1, 2, 3}, {2, 1, 3}}
Fixing the elements {1,2}
using $S_4$:
In[49]:= Permute[Range[4], GroupStabilizer[SymmetricGroup[4], {1, 2}]]
Out[49]= {{1, 2, 3, 4}, {1, 2, 4, 3}}