Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to return s1*s2 of a symmetric group in Sage?

I wrote a function and would like to return reduced expressions of the form in Sage.

def LongestPermInDoubleCoset(S1,w,S2): # longest element in S1 w S2, S1,S2 are subgroups of S_n

    winner = W.identity()
    for u1 in S1:
        for u2 in S2:
            t1=u1*w*u2
            if t1.length()>winner.length():
                winner=t1
    r=winner

return r

W=SymmetricGroup(6)
[s1,s2,s3,s4,s5] = W.simple_reflections()
S1=[W.identity(), s1]
S2=[W.identity(),s2]
t1=LongestPermInDoubleCoset(S1,s1,S2)
t2=t1.reduced_word()
t2

I obtained t2=[1,2]. But I would like to return s1*s2. How to do that? Thank you very much.