One line notation of elements in a symmetric group in sage

99 Views Asked by At

Let $S_n$ be the symmetric group over $\{1,2,\ldots,n\}$. Let $w=s_{i_1} \cdots s_{i_m} \in S_n$, where $s_i$'s are simple reflections. How to convert $w$ to a one-line notation in Sage? Thank you very much.

1

There are 1 best solutions below

3
On

You could do so through GAP. Construct an isomorphism from the symmetric group to a finitely presented group (which uses the Weyl generators):

gap> n:=5;; # e.g.
gap> s:=SymmetricGroup(n);
Sym( [ 1 .. 5 ] )
gap> iso:=IsomorphismFpGroup(s);
[ (1,2), (2,3), (3,4), (4,5) ] -> [ S_5.1, S_5.2, S_5.3, S_5.4 ]
gap> fp:=Range(iso);;
gap> s1:=fp.1;s2:=fp.2;s3:=fp.3;s4:=fp.4;
S_5.1
S_5.2
S_5.3
S_5.4

Then use the isomorphism to convert word to permutation and get the image list with ListPerm:

gap> word:=s2*s3*s4*s3*s2; # for example
S_5.2*S_5.3*S_5.4*S_5.3*S_5.2
gap> perm:=PreImagesRepresentative(iso,word);
(2,5)
gap> ListPerm(perm,n);
[ 1, 5, 3, 4, 2 ]