Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You may try this :

A1, A2, L, M, P, Q, X, Y = (MatrixSpace(QQ, 2).random_element()
                            for u in range(8))
LL = [[A1,P,Q], [A1,Q,P], [P,Q,A1], [A2,L,M], [A2,M,L], [A2,X,Y], [Q,L,A1]]
def is_sim(x,y):
    if not bool(x[0] == y[0]): return False
    # Testing for Sets equality is problematic.
    # see https://ask.sagemath.org/question/67166/test-for-set-equality/
    if any([u not in Set(x[1:]) for u in Set(y[1:])]): return False
    if any([u not in Set(y[1:]) for u in Set(x[1:])]): return False
    return True
R = LL[0]
for u in LL[1:]:
    if not any([is_sim(u, v) for v in R]):
        R.append(u)

which gives :

sage: R

[
                               [[-1/2 -1/2]        
                               [   2    0], [ 0  0]
[-1/2 -1/2]  [ 0 -1]  [ 0  0]  [ 0 -1], [ 0 -1]    
[   2    0], [ 0 -2], [ 0 -1], [ 0 -2]]            ,

[[ 0 -1]              [[ 0 -1]                [[ 0 -1]          
[ 0 -2], [ 0  0]      [ 0 -2], [1/2   0]      [ 0 -2], [1/2   1]
[ 0 -1], [-1/2 -1/2]  [  1  -1], [-1/2    0]  [  0  -1], [-1 -1]
[   2    0]]        , [   1   -1]]          , [ 2  0]]          ,

[[ 0  0]              
[ 0 -1], [1/2   0]    
[  1  -1], [-1/2 -1/2]
[   2    0]]          
]