Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You should mention what error you got. For creating all the 2x2 matrices over some finite field use the MatrixSpace class.

sage: M = MatrixSpace(GF(3), 2, 2)
sage: M
Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 3
sage: Mlist = M.list() # List containing all the matrices
sage: len(Mlist)
81

As for your function, it is also not correct, unless you have copy-pasted incorrectly.

  1. First, the indentation in the function is wrong.
  2. Secondly, you need not define UT to be a symbolic variable because you are redefining UT to be a list.
  3. Thirdly, you are not returning anything from the function, so I don't know whether your function is incomplete, or this is what you intended.