# Revision history [back]

### localization

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 de following code:

K.<i> = NumberField(x^2 + 1)
R =K.maximal_order().localization(5)
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(7), but they yield the same mistake. 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?

 2 None slelievre 15579 ●19 ●144 ●307 http://carva.org/samue...

### localizationRing 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 de following code:

K.<i> = NumberField(x^2 + 1)
R =K.maximal_order().localization(5)
= K.maximal_order().localization(7)
MS = span([[0,1,0]],R)
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() = K.maximal_order() and R=ZZ.localization(7), R = ZZ.localization(5), but they yield the same mistake. similar errors. So I understand that sage 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 Sage to see my ring as a PID?

### 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 de 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?