MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: S_4 elements


Jorge,

first load the appropriate package

In[29]:=
<< "DiscreteMath`Combinatorica`"

then you get all 4!=24 permutations using the function Permutation of 
the package

In[30]:=
x = {1, 2, 3, 4}
y = Permutations[x]

Out[30]=
{1, 2, 3, 4}

Out[31]=
{{1, 2, 3, 4}, {1, 2, 4, 3}, {1, 3, 2, 4}, {1, 3, 4, 2},
   {1, 4, 2, 3}, {1, 4, 3, 2}, {2, 1, 3, 4}, {2, 1, 4, 3},
   {2, 3, 1, 4}, {2, 3, 4, 1}, {2, 4, 1, 3}, {2, 4, 3, 1},
   {3, 1, 2, 4}, {3, 1, 4, 2}, {3, 2, 1, 4}, {3, 2, 4, 1},
   {3, 4, 1, 2}, {3, 4, 2, 1}, {4, 1, 2, 3}, {4, 1, 3, 2},
   {4, 2, 1, 3}, {4, 2, 3, 1}, {4, 3, 1, 2}, {4, 3, 2, 1}}

The cycle structure of the permutations can be obtained using the 
function ToCycles contained in the package, ie.

In[45]:=
ToCycles /@ y

Out[45]=
{{{1}, {2}, {3}, {4}}, {{1}, {2}, {4, 3}},
   {{1}, {3, 2}, {4}}, {{1}, {3, 4, 2}}, {{1}, {4, 3, 2}},
   {{1}, {4, 2}, {3}}, {{2, 1}, {3}, {4}},
   {{2, 1}, {4, 3}}, {{2, 3, 1}, {4}}, {{2, 3, 4, 1}},
   {{2, 4, 3, 1}}, {{2, 4, 1}, {3}}, {{3, 2, 1}, {4}},
   {{3, 4, 2, 1}}, {{3, 1}, {2}, {4}}, {{3, 4, 1}, {2}},
   {{3, 1}, {4, 2}}, {{3, 2, 4, 1}}, {{4, 3, 2, 1}},
   {{4, 2, 1}, {3}}, {{4, 3, 1}, {2}}, {{4, 1}, {2}, {3}},
   {{4, 2, 3, 1}}, {{4, 1}, {3, 2}}}

Or, if you like to drop trivial cycles of length 1,

define

In[38]:=
toEssentialCycles[p_] := Select[ToCycles[p], Length[#1] > 1 & ]

and get

In[43]:=
toEssentialCycles /@ y

Out[43]=
{{}, {{4, 3}}, {{3, 2}}, {{3, 4, 2}}, {{4, 3, 2}},
   {{4, 2}}, {{2, 1}}, {{2, 1}, {4, 3}}, {{2, 3, 1}},
   {{2, 3, 4, 1}}, {{2, 4, 3, 1}}, {{2, 4, 1}},
   {{3, 2, 1}}, {{3, 4, 2, 1}}, {{3, 1}}, {{3, 4, 1}},
   {{3, 1}, {4, 2}}, {{3, 2, 4, 1}}, {{4, 3, 2, 1}},
   {{4, 2, 1}}, {{4, 3, 1}}, {{4, 1}}, {{4, 2, 3, 1}},
   {{4, 1}, {3, 2}}}

Regards,
Wolfgang


Jorge Luis Llanio wrote:

> Hi everybody in the list!
> 
> please, I need the listing of the symmetric S_4 group elements, ex.:
> 
> (1)(2)(3)(4);  (1234); (12)(34), etc      a total of 4! = 24 elements
> 
> 
> Thank you very much in advance,   Jorge
> 
> 


  • Prev by Date: Re: matrix operations
  • Next by Date: Re: Solving
  • Previous by thread: Re: S_4 elements
  • Next by thread: Arrow Body Width