ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 28 Nov 2012 20:18:18 -0600Quotienting a ring of integershttps://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/I was trying to play within the ring of integers of a number field, when I decided to quotient by an ideal. It raised an "IndexError: the number of names must equal the number of generators" exception, which was quite unexpected ; here is an example:
K=NumberField(x**2+1,x)
O=K.ring_of_integers()
O.quo(O.ideal(3))
as you see, I'm using the same ring to define the ideal I want to quotient with, so there is mathematically no problem... so I think either I found a bug or something needs to be documented better. How does one work in a quotient of a ring of integers?Wed, 21 Nov 2012 18:52:30 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/Comment by Francis Clarke for <p>I was trying to play within the ring of integers of a number field, when I decided to quotient by an ideal. It raised an "IndexError: the number of names must equal the number of generators" exception, which was quite unexpected ; here is an example:</p>
<pre><code>K=NumberField(x**2+1,x)
O=K.ring_of_integers()
O.quo(O.ideal(3))
</code></pre>
<p>as you see, I'm using the same ring to define the ideal I want to quotient with, so there is mathematically no problem... so I think either I found a bug or something needs to be documented better. How does one work in a quotient of a ring of integers?</p>
https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18666#post-id-18666Thu, 22 Nov 2012 20:28:08 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18666#post-id-18666Answer by Francis Clarke for <p>I was trying to play within the ring of integers of a number field, when I decided to quotient by an ideal. It raised an "IndexError: the number of names must equal the number of generators" exception, which was quite unexpected ; here is an example:</p>
<pre><code>K=NumberField(x**2+1,x)
O=K.ring_of_integers()
O.quo(O.ideal(3))
</code></pre>
<p>as you see, I'm using the same ring to define the ideal I want to quotient with, so there is mathematically no problem... so I think either I found a bug or something needs to be documented better. How does one work in a quotient of a ring of integers?</p>
https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?answer=14292#post-id-14292Does this do what you want?
sage: K.<i> = QuadraticField(-1)
sage: F.<j> = K.residue_field(3)
sage: F.order()
9
sage: j.charpoly()
x^2 + 1
Thu, 22 Nov 2012 20:33:36 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?answer=14292#post-id-14292Comment by Snark for <p>Does this do what you want?</p>
<pre><code>sage: K.<i> = QuadraticField(-1)
sage: F.<j> = K.residue_field(3)
sage: F.order()
9
sage: j.charpoly()
x^2 + 1
</code></pre>
https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18665#post-id-18665Ah, this "residue_field" method is a nice catch, I hadn't seen it -- but the problem is that for the examples I have in mind, the number field might not be quadratic, and the ideals might not be prime ; the first isn't a problem with residue_field, while the second point is a no-go. I like your answer but it doesn't solve what I want. :-(Fri, 23 Nov 2012 00:25:06 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18665#post-id-18665Comment by Snark for <p>Does this do what you want?</p>
<pre><code>sage: K.<i> = QuadraticField(-1)
sage: F.<j> = K.residue_field(3)
sage: F.order()
9
sage: j.charpoly()
x^2 + 1
</code></pre>
https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18628#post-id-18628Ah, yes! That definitely helps! If you edit your answer to include that, I'll gladly accept it as a valid answer. Thanks!Wed, 28 Nov 2012 20:18:18 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18628#post-id-18628Comment by Francis Clarke for <p>Does this do what you want?</p>
<pre><code>sage: K.<i> = QuadraticField(-1)
sage: F.<j> = K.residue_field(3)
sage: F.order()
9
sage: j.charpoly()
x^2 + 1
</code></pre>
https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18661#post-id-18661For quotients by non-prime ideals, the problem with what you had (using quo or its synonyms quotient and quotient_ring) was that you didn't give a name to the generator of the quotient ring. Thus R = O.quo(O.ideal(3), 'a') and R = O.quo(O.ideal(5), 'a') both work. But at present Sage cannot do much with these rings. For example, R.is_finite() gives rise to a NotImplementedError()Fri, 23 Nov 2012 11:29:03 -0600https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18661#post-id-18661