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, 15 Apr 2021 18:13:46 +0200Ring not recognized as a PIDhttps://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/I need to work with finitely generated modules over a PID, which the localization at a prime of the ring of Gaussian integers. It happens to be a PID, but if I try to execute the following code:
K.<i> = NumberField(x^2 + 1)
R = K.maximal_order().localization(7)
MS = span([[0, 1, 0]], R)
I get this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-41-97a6c80cace8> in <module>
----> 1 MS = span([[Integer(0),Integer(1),Integer(0)]],R)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/modules/free_module.py in span(gens, base_ring, check, already_echelonized)
686 if R not in PrincipalIdealDomains():
687 raise TypeError("The base_ring (= %s) must be a principal ideal "
--> 688 "domain." % R)
689 if not gens:
690 return FreeModule(R, 0)
TypeError: The base_ring (= Gaussian Integers in Number Field in i with defining polynomial x^2 + 1 localized at (7,)) must be a principal ideal domain.
I have tried with `R = K.maximal_order()` and `R = ZZ.localization(5)`, but they yield similar errors. So I understand that Sage doesn't automatically recognize those rings as PIDs, even though they are and there is a constructive way to find the generator of an ideal.
Is there a way for me to get Sage to see my ring as a PID?Wed, 14 Apr 2021 08:23:43 +0200https://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/Comment by slelievre for <p>I need to work with finitely generated modules over a PID, which the localization at a prime of the ring of Gaussian integers. It happens to be a PID, but if I try to execute the following code:</p>
<pre><code>K.<i> = NumberField(x^2 + 1)
R = K.maximal_order().localization(7)
MS = span([[0, 1, 0]], R)
</code></pre>
<p>I get this error:</p>
<pre><code>---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-41-97a6c80cace8> in <module>
----> 1 MS = span([[Integer(0),Integer(1),Integer(0)]],R)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/modules/free_module.py in span(gens, base_ring, check, already_echelonized)
686 if R not in PrincipalIdealDomains():
687 raise TypeError("The base_ring (= %s) must be a principal ideal "
--> 688 "domain." % R)
689 if not gens:
690 return FreeModule(R, 0)
TypeError: The base_ring (= Gaussian Integers in Number Field in i with defining polynomial x^2 + 1 localized at (7,)) must be a principal ideal domain.
</code></pre>
<p>I have tried with <code>R = K.maximal_order()</code> and <code>R = ZZ.localization(5)</code>, but they yield similar errors. So I understand that Sage doesn't automatically recognize those rings as PIDs, even though they are and there is a constructive way to find the generator of an ideal.
Is there a way for me to get Sage to see my ring as a PID?</p>
https://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/?comment=56665#post-id-56665There would be a lot to do around orders in number fields in Sage.Thu, 15 Apr 2021 18:13:46 +0200https://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/?comment=56665#post-id-56665Comment by vdelecroix for <p>I need to work with finitely generated modules over a PID, which the localization at a prime of the ring of Gaussian integers. It happens to be a PID, but if I try to execute the following code:</p>
<pre><code>K.<i> = NumberField(x^2 + 1)
R = K.maximal_order().localization(7)
MS = span([[0, 1, 0]], R)
</code></pre>
<p>I get this error:</p>
<pre><code>---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-41-97a6c80cace8> in <module>
----> 1 MS = span([[Integer(0),Integer(1),Integer(0)]],R)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/modules/free_module.py in span(gens, base_ring, check, already_echelonized)
686 if R not in PrincipalIdealDomains():
687 raise TypeError("The base_ring (= %s) must be a principal ideal "
--> 688 "domain." % R)
689 if not gens:
690 return FreeModule(R, 0)
TypeError: The base_ring (= Gaussian Integers in Number Field in i with defining polynomial x^2 + 1 localized at (7,)) must be a principal ideal domain.
</code></pre>
<p>I have tried with <code>R = K.maximal_order()</code> and <code>R = ZZ.localization(5)</code>, but they yield similar errors. So I understand that Sage doesn't automatically recognize those rings as PIDs, even though they are and there is a constructive way to find the generator of an ideal.
Is there a way for me to get Sage to see my ring as a PID?</p>
https://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/?comment=56649#post-id-56649Note that Sage does not even recognize the maximal order as a PID
sage: O = K.maximal_order()
sage: O.class_number()
1
sage: O in PrincipalIdealDomains()
FalseWed, 14 Apr 2021 08:48:34 +0200https://ask.sagemath.org/question/56648/ring-not-recognized-as-a-pid/?comment=56649#post-id-56649