I am learning how to compute with sage, I am very much used to maple. So I have the following code in Maple and want to covert it in Sage. So here is my problem. So I am working in a symmetric group say for example $S_3$ and I want all the monotonic transposition tuples Monseq(3) = $$[[(2,3),(2,3)],[(2,3),(1,3)],[(1,3),(2,3)],[(1,3),(1,3)],[(1,2),(2,3)],[(1,2),(1,3)],[(1,2),(1,2)] $$ that is the tuples $(a,b)(c,d)$ such that $b\leq d$, so my programme in maple I have written below can compare the inequality and give back the list. In sage I used
G = SymmetricGroup(3)
g = G((1,2))
C = ConjugacyClass(G,g)
But then I cannot compare the elements of C, something like I did with ${\bf{PermSupport}}$ in maple, Is there any similar function in Sage to do it? I put my code for maple below.
Mon2seq := proc (n) local a, b, P;
P := [];
for a in ConjugacyClass([[1, 2]], Symm(n)) do
for b in ConjugacyClass([[1, 2]], Symm(n)) do
if PermSupport(a)[2] <= PermSupport(b)[2]
then P := [op(P), [a, b]]
end if
end do
end do;
return P
end proc
Monseq(3) = $$[[(2,3),(2,3)],[(2,3),(1,3)],[(1,3),(2,3)],[(1,3),(1,3)],[(1,2),(2,3)],[(1,2),(1,3)],[(1,2),(1,2)] $$
The method
cycle_tuplesis helpful: it returns a list of tuples which represent the permutation. In the case of transpositions, this list has length 0, and we want to compare the 1st element in each such tuple:Then
Pshould be equal toFor the comparison you could instead use the
supportmethod: ifa = (1,2), thena.support()is the set{1, 2}, sosorted(a.support())would be[1, 2]andsorted(a.support())[1]would be2. Or usemax(a.support()).