ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 29 Nov 2012 03:18:18 +0100Quotienting 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?Thu, 22 Nov 2012 01:52:30 +0100https://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-18666Fri, 23 Nov 2012 03:28:08 +0100https://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
Fri, 23 Nov 2012 03:33:36 +0100https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?answer=14292#post-id-14292Comment 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 18:29:03 +0100https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18661#post-id-18661Comment 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!Thu, 29 Nov 2012 03:18:18 +0100https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18628#post-id-18628Comment 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 07:25:06 +0100https://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/?comment=18665#post-id-18665