# Checking if the given matrices will generate a finite Group

Hello,

I am a newcomer to the SageMath. Basically, I have 100 matrices which have 4x4 dimensions in python. I want to check if this 100 matrices can generate an infinite group or not. P.S These matrices produced as SU(2) matrices and then were converted 4x4 matrices.

According to the document of sagemath, I tried to write a code but I am constantly having error:

```
from sage.all import *
for i in su4_np:
sage_matrix = np.matrix((i),complex)
sage_matrix = matrix(sage_matrix)
matrix_su4_np.append(sage_matrix)
#F = GL(4, 5)
F = SL(4,5) #CC ,CyclotomicField(10)
gens = matrix_su4_np #this is the matrix which contains all 100 matrices
G = MatrixGroup(F,4,gens)
#G.order
MatrixGroup(F,4,gens).is_finite()
```

This is the error:

```
> --------------------------------------------------------------------------- MemoryError
> Traceback (most recent call last)
> <ipython-input-218-8f1964d06d6d> in
> <module>
> 4
> 5 gens = matrix_su4_np
> ----> 6 G = MatrixGroup(F,4,gens)
> 7 MatrixGroup(F,4,gens).is_finite()
>
> /usr/lib/python3/dist-packages/sage/misc/lazy_import.pyx
> in
> sage.misc.lazy_import.LazyImport.__call__
> (build/cythonized/sage/misc/lazy_import.c:3686)()
> 351 True
> 352 """
> --> 353 return self.get_object()(*args, **kwds)
> 354
> 355 def __repr__(self):
>
> /usr/lib/python3/dist-packages/sage/groups/matrix_gps/finitely_generated.py
> in MatrixGroup(*gens, **kwds)
> 290 if len(gens) == 0:
> 291 raise ValueError('need at least one generator')
> --> 292 gens = normalize_square_matrices(gens)
>
> 293 if check and any(not
> g.is_invertible() for g in gens):
> 294 raise ValueError('each generator must be an invertible
> matrix')
>
> /usr/lib/python3/dist-packages/sage/groups/matrix_gps/finitely_generated.py
> in normalize_square_matrices(matrices)
> 120 continue
> 121 try:
> --> 122 m = list(m)
> 123 except TypeError:
> 124 gens.append(m)
MemoryError:
> Blockquote
```

I am guessing the error comes because of the `F = SL(4,5)`

line. However, I do not know what to put instead of that line.
Do we have a function which can check if we have finite group or not just from matrices?
How to solve this error?
I tried quite a lot combination to solve this problem but I always got an error

Using

`i`

as a variable is not a good idea, it overwrites in the session the variable corresponding to $\sqrt{-1}$. The provided code does not introduce`su4_np`

, so it is hard to reproduce the error, or guess its origin. Also, mixing`np`

(inexact) functionality (which i suppose comes from some tacit`import numpy as np`

) with exact sage computations cannot lead to an answer. Please always provide full code that reproduces the error, best by isolating a minimal piece of code giving the error.