Ask Your Question
0

Iterating over finite structures

asked 2017-06-10 09:33:41 +0100

Jason Polak gravatar image

updated 2022-01-22 09:23:35 +0100

FrédéricC gravatar image

I am trying to use sage for some algebra computations involving finite rings. Since the structures are finite, I would like to iterate over all the elements of the structure. I know how to iterate in some cases for polynomials in polynomial rings of a certain degree (not necessarily finite):

S.<x> = PolynomialRing(Zmod(9))

Then I could do

for i in S.polynomials(of_degree = 2):

To iterate over all quadratics. What I'd like to do is iterate over all elements of a structure like the finite ring:

R = GroupAlgebra( GL(2, Zmod(2)), Zmod(2))

Is there a way to do this in Sage easily?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-06-10 17:00:16 +0100

updated 2017-06-15 17:37:59 +0100

"Easily"? I don't know if this counts, but it works:

sage: R = GroupAlgebra( GL(2, Zmod(2)), Zmod(2))
sage: V = GF(2)**6  # R is 6-dimensional as a vector space
sage: [R.from_vector(v) for v in V]
[0, [0 1]
 [1 0], [0 1]
 [1 1], [0 1]
 [1 0] + [0 1]
 [1 1], [1 0]
...

So you could do

sage: for r in (R.from_vector(v) for v in V): ...

(Or just iterate over V, calling R.from_vector(...) each time.)

edit flag offensive delete link more

Comments

Thank you for the answer. What you do works for V = GF(2)**6, but I already can do that because "for v in V" works here. "for v in V" does not work if "V = GroupAlgebra( GL(2, Zmod(2)), Zmod(2))". My question is precisely for those structures that are finite, and yet don't work with "for v in V".

Jason Polak gravatar imageJason Polak ( 2017-06-15 05:40:47 +0100 )edit

The second line in my Sage block involves precisely your R. The point is that it converts between elements of V, where you can iterate, to elements of R.

John Palmieri gravatar imageJohn Palmieri ( 2017-06-15 17:37:41 +0100 )edit

I've edited it to make the definition of R explicit.

John Palmieri gravatar imageJohn Palmieri ( 2017-06-15 17:38:16 +0100 )edit

Thank you John. I didn't understand your answer at first but I get it now. It works well seems to be the easiest way to do computations of this nature!

Jason Polak gravatar imageJason Polak ( 2017-07-05 09:58:47 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-10 09:33:41 +0100

Seen: 783 times

Last updated: Jun 15 '17