Command in sage like permsupport in maple

67 Views Asked by At

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)] $$

1

There are 1 best solutions below

5
On BEST ANSWER

The method cycle_tuples is 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:

G = SymmetricGroup(3)
g = G((1,2))
C = ConjugacyClass(G,g)
P = []
for a in C:
    for b in C:
        if a.cycle_tuples()[0][1] <= b.cycle_tuples()[0][1]:
            P.append([a,b])

Then P should be equal to

[[(2,3), (2,3)],
 [(2,3), (1,3)],
 [(1,2), (2,3)],
 [(1,2), (1,2)],
 [(1,2), (1,3)],
 [(1,3), (2,3)],
 [(1,3), (1,3)]]

For the comparison you could instead use the support method: if a = (1,2), then a.support() is the set {1, 2}, so sorted(a.support()) would be [1, 2] and sorted(a.support())[1] would be 2. Or use max(a.support()).