Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

List (or set) of matrices

Hi, I am trying to write a function that will put all the 2x2 matrices over a finite field Z_p into a list or set. I am just switching from Mathematica to Sage, so this might be way off, but could you please help me go in the right direction?

def ListM(p): 
var('UT')
UT=[]
    for i1 in range(0,p): 
       for i2 in range(0,p): 
          for i3 in range(0,p):
             for i4 in range(0,p):
                UT=UT+[matrix([[i1,i2],[i3,i4]])]

I am trying to create a dummy list UT, and recursively add to it. I want it to serve as a variable though. The output gives me some error as well. I've been on it for a few hours and cant seem to figure it out.

List (or set) of matrices

Hi, I am trying to write a function that will put all the 2x2 matrices over a finite field Z_p into a list or set. I am just switching from Mathematica to Sage, so this might be way off, but could you please help me go in the right direction?

def ListM(p): 
var('UT')
UT=[]
    for i1 in range(0,p): 
       for i2 in range(0,p): 
          for i3 in range(0,p):
             for i4 in range(0,p):
                UT=UT+[matrix([[i1,i2],[i3,i4]])]

I am trying to create a dummy list UT, and recursively add to it. I want it to serve as a variable though. The output gives me some error as well. I've been on it for a few hours and cant seem to figure it out.