M = MatrixSpace(ZZ,4,4) for A in M: if A.determinant()!=0: p=A.eigenvalues() o=list(p) for e in o: X = Set([1,2,3,4]) for i,j in X: if e[i]*e[j]==1: print(A)
I am trying to find those 4 by 4 nonsingular integer matrices which satisfy the following property: Suppose that if $\lambda$ is an eigenvalue of $A$ iff $\frac{1}{\lambda}$ is also an eigenvalue of $A$ with the same multiplicity as that of $\lambda$. How to obtain that class of matrices?