Re: groups
- To: mathgroup at smc.vnet.net
- Subject: [mg7527] Re: groups
- From: Chun Che Li <ccli at math.ucla.edu>
- Date: Tue, 10 Jun 1997 23:18:03 -0400 (EDT)
- Organization: University of California, Los Angeles
- Sender: owner-wri-mathgroup at wolfram.com
Hi! Hope this program can help you.
-------------------------------------------------------------
(* Multiplication and Inverse for permutation group *)
Mult[a_List, b_List] := Module[{n = Length[a]}, Table[a[[b[[i]]]], {i, 1,
n}]]
Inv[c_List]:=Last[Transpose[Union[Table[{c[[i]],i},{i,1,Length[c]}]]]]
(* generators -> unit, generators, and inverse of generators *)
Initiate[generators_List]:=
( Unit=Range[Length[generators[[1]]]];
Union[Join[generators,{Unit},Inv/@generators]])
(* elements -> elements multiply elements , till this set remain unchange *)
Group[generators_List]:=
Module[{Elem=Initiate[generators],NoOfElem=0},
While[NoOfElem=!=Length[Elem],NoOfElem=Length[Elem];
Elem=Union[Flatten[Outer[Mult,Elem,Elem,1,1],1]]];
Elem]
______________________________________________________________________
Group[generators] gives the group generated by the elements.
e.g.
In[5]:=Group[{{2,3,4,5,1}}]
Out[5]:={{1,2,3,4,5},{2,3,4,5,1},{3,4,5,1,2},{4,5,1,2,3},{5,1,2,3,4}}
In[6]:=Group[{{2,3,4,5,1},{2,1,3,4,5}}];
In[7]:=Length[%]
Out[7]=120
This show that the group S_5 is generator by (23451) and (12)
Charles,Li Chun Che
On 4 Jun 1997, Will Self wrote:
> I would like a function that accepts as inputs some permutations of
> {1, 2, 3, . . . , n} and returns the group generated by them.
>
>
> Will Self
> Montana
>
>
>