1 | initial version |

The short answer is to use sets. The longer answer involves some technical details: in Sage, matrices are "mutable" (see https://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix0.html?highlight=set_immutable#sage.matrix.matrix0.Matrix.set_immutable for some details), and mutable things can't be elements of sets. So you can do this:

```
def immutable_copy(mat): # could use a shorter name
"""
Return a copy of matrix ``mat`` which is immutable.
"""
return matrix(mat, immutable=True)
```

Then given your lists `L1`

, `L2`

, `L3`

, you can test this:

```
set(immutable_copy(mat) for mat in L1) == set(immutable_copy(mat) for mat in L2)
```

It will be `True`

for L1 and L2, false for other pairs. So you could, for example, do this:

```
answer = [] # what you actually want to print
seen = [] # sets you've seen so far
for L in [L1, L2, L3]:
S = set(immutable_copy(mat) for mat in L)
if S not in seen:
answer.append(L)
seen.append(S)
show(*answer)
```

2 | No.2 Revision |

The short answer is to use sets. The longer answer involves some technical details: in Sage, matrices are "mutable" (see https://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix0.html?highlight=set_immutable#sage.matrix.matrix0.Matrix.set_immutable for some details), and mutable things can't be elements of sets. So you can do this:

```
def immutable_copy(mat): # could use a shorter name
"""
Return a copy of matrix ``mat`` which is immutable.
"""
return matrix(mat, immutable=True)
```

Then given your lists `L1`

, `L2`

, `L3`

, you can test this:

```
set(immutable_copy(mat) for mat in L1) == set(immutable_copy(mat) for mat in L2)
```

It will be `True`

for L1 and L2, false for other pairs. So you could, for example, do this:

```
answer = [] # what you actually want to print
seen = []
```~~ ~~# sets you've seen so far
for L in [L1, L2, L3]:
S = set(immutable_copy(mat) for mat in L)
if S not in seen:
answer.append(L)
seen.append(S)
show(*answer)

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.