Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is not a single command to achieve that, but in this particular case you can do the following:

sage: k = GF(5)
sage: M = MatrixSpace(k,2,2)
sage: units = [m for m in M if m.is_invertible()]
sage: nonunits = [m for m in M if not m.is_invertible()]
sage: len(units)
sage: len(nonunits)

Since every ideal must be generated by some nonunits, but also changing a generator by a unit times it does not change the ideal, let's check how many essentially distinct generators can we have:

sage: associated = []
sage: for m in nonunits:
....:     if not True in [a*m in associated for a in units]:
....:         associated.append(m)
sage: associated
[0 0]  [1 0]  [0 1]  [1 1]  [2 1]  [1 2]  [4 1]
[0 0], [0 0], [0 0], [0 0], [0 0], [0 0], [0 0]

That is, you only want to check for subsets of that set as possible generators of your ideals. But it is clear that two of those elements actually generate the other four, so you just need to check for ideals generated by up to two generators.

You have the trivial ideal, the other 6 principal ideals generated by the other elements in associated, and the only thing you need to check is if the ideal generated by two of them is the total one. It is easy to see that it is, but in case you don't notice at first sight you can just check it directly:

sage: for (a,b) in Tuples(units,2):
....:     if (a*associated[1] + b*associated[2]).is_invertible():
....:         print a
....:         print b
....:         break
[0 1]
[1 0]
[1 0]
[0 1]

There you are: only six nontrivial ideals, that happen to be principal.