Ask Your Question
0

Iterate over Elements of Finite Quotient (of a Polynomial Ring)

asked 2022-12-02 14:30:40 +0200

Thrash gravatar image

updated 2022-12-02 20:47:12 +0200

Consider the following, which works:

sage: R.<x> = Integers(4)[]
sage: Q.<a> = R.quotient(x^2)
sage: for q in Q:
....:     q
....:     
0
1
2
3
a
a + 1
a + 2
a + 3
2*a
2*a + 1
2*a + 2
2*a + 3
3*a
3*a + 1
3*a + 2
3*a + 3

Now if I add a generator to the ideal and execute

sage: Q.<a> = R.quotient((x^2,2*x))
sage: for q in Q:
....:     q
....:

which should yield a quotient with 8 elements, I get an error:

NotImplementedError: object does not support iteration

How can I make it work? Sage doesn't seem to be able to deal with finite rings that aren't principal ideal rings.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
-1

answered 2022-12-02 20:07:28 +0200

Emmanuel Charpentier gravatar image

updated 2022-12-02 20:10:39 +0200

Use GF(4) (finite field) rather Zmod(4) (finite ring not explicitely known to be a field) :

sage: reset()
sage: Zmod(4).is_field()
False
sage: GF(4).is_field()
True
sage: R.<x>=Zmod(4)[]
sage: Q.<a>=R.quotient((x^2,2*x))
sage: len(list(Q))
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Input In [242], in <cell line: 1>()
----> 1 len(list(Q))

File /usr/local/sage-9/src/sage/rings/ring.pyx:220, in sage.rings.ring.Ring.__iter__()
    218         NotImplementedError: object does not support iteration
    219     """
--> 220     raise NotImplementedError("object does not support iteration")
    221 
    222 def __len__(self):

NotImplementedError: object does not support iteration

But :

sage: R.<x>=GF(4)[]
sage: Q.<a>=R.quotient((x^2,2*x))
sage: len(list(Q))
16
sage: list(Q)
[0,
 z2,
 z2 + 1,
 1,
 z2*a,
 z2*a + z2,
 z2*a + z2 + 1,
 z2*a + 1,
 (z2 + 1)*a,
 (z2 + 1)*a + z2,
 (z2 + 1)*a + z2 + 1,
 (z2 + 1)*a + 1,
 a,
 a + z2,
 a + z2 + 1,
 a + 1]

HTH,

edit flag offensive delete link more

Comments

I would like to do calculations over Zmod(4), which is not a field. Over GF(4), the given ideal is just the ideal generated by x^2 because 2=0 and thus 2x=0. That's why in that case the quotient has 16 elements, but over Zmod(4) the quotient has 8 elements. This is significantly different. So far, Sage doesn't seem to be able to deal with finite rings that aren't principal ideal rings. Try also the following:

sage: R.<x,y> = GF(4)[]
sage: Q = R.quotient((x^2,y^2,x*y))
sage: list(Q)
Thrash gravatar imageThrash ( 2022-12-02 20:39:27 +0200 )edit
1

It is a strange suggestion to use GF(4) instead of Zmod(4) as they are different algebraic objects.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-12-03 22:58:57 +0200 )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: 2022-12-02 14:30:40 +0200

Seen: 116 times

Last updated: Dec 02 '22