# All Ideals of Ring

For given group G, by G.subgroups(), we can list all subgroups. now my question is :

Is there something for subgroups() for finding all left ideals of a given ring. For instance, k = GF(5); M = MatrixSpace(k,2,2) How can I have all left ideals?

edit retag close merge delete

Sort by » oldest newest most voted

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)
480
sage: len(nonunits)
145


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.

more

Nice. Note that instead of True in [a*m in associated for a in units], you can use the more pythonic any([a*m in associated for a in units]).

( 2014-11-28 20:34:23 -0600 )edit