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.Wed, 14 Apr 2021 08:23:43 +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?MickaĆ«l MontessinosWed, 14 Apr 2021 08:23:43 +0200https://ask.sagemath.org/question/56648/Number field basis containing 1https://ask.sagemath.org/question/42150/number-field-basis-containing-1/ In Sage, the default basis for a maximal order $O_K$ often does not contain the element $1$:
sage: QuadraticField(-3).ring_of_integers().basis()
[1/2*a + 1/2, a]
However, $1$ is always a primitive lattice vector in $O_K$. Is there an elegant way to produce a basis containing $1$?eodorneyTue, 24 Apr 2018 21:21:01 +0200https://ask.sagemath.org/question/42150/Calculation of maximal order fails even when using "maximize_at_primes"https://ask.sagemath.org/question/40677/calculation-of-maximal-order-fails-even-when-using-maximize_at_primes/I would like to calculate the maximal order of a field for which I already know at which primes we should maximize.
This means that the discriminant does not have to be factored, which is normally the bottleneck of this algorithm.
I did
d = [2,3,5,7,11,13,17,19]
K.<y> = NumberField([x^2 - di for di in d], maximize_at_primes=[2])
RR = K.maximal_order()
The last command did not finish overnight, but gave the following warning:
"*** Warning: MPQS: number too big to be factored with MPQS,
giving up."
Which seems to indicate that the program is indeed trying to perform a large factorization despite the command "maximize_at_primes=[2]"
Meanwhile, Magma has no problem performing this computation in a few hours:
R<x> := PolynomialRing(Integers());
K := NumberField([x^2 - 2,x^2 - 3 , x^2-5,x^2-7,x^2 - 11,x^2 - 13 , x^2 - 17 , x^2 - 19]:Abs);
O := MaximalOrder(K: Ramification := [2]);
Am I doing something wrong ?
JF BiassebiasseThu, 18 Jan 2018 15:58:26 +0100https://ask.sagemath.org/question/40677/interger-ring() and maximal_order() is the same in numberfieldhttps://ask.sagemath.org/question/10823/interger-ring-and-maximal_order-is-the-same-in-numberfield/interger-ring() and maximal_order() is the same in numberfield,I try many times,get same rusults...cjshWed, 11 Dec 2013 04:31:03 +0100https://ask.sagemath.org/question/10823/Computing maximal orders in relative extensionshttps://ask.sagemath.org/question/9203/computing-maximal-orders-in-relative-extensions/As part of a project, I am translating some MAGMA code to SAGE. The relevant piece of code computes the maximal order of the relative extension of `Qa12`, a number field of degree 20, by the polynomial `y^2 - kappa12`:
subOrderK:=ext<OO | y^2-kappa12>;
subOrderK:=AbsoluteOrder(subOrderK);
D:=Discriminant(subOrderK);
for p in PrimeDivisors(D) do
subOrderK:=pMaximalOrder(subOrderK,p);
end for;
OOK:=subOrderK;
Here `OO` is the ring of integers (i.e. the maximal order) of `Qa12`.
As I did not see a way to translate this word for word (if I am missing something, please point it out), I tried a different approach. Here is my code (in SAGE):
L.<c> = Qa12.extension(y^2-kappa12)
L.<alpha> = L.absolute_field()
subOrderK = L.order(alpha)
D = subOrderK.discriminant()
for p in factor(D):
subOrderK = L.maximal_order(p[0])
OOK = subOrderK
Note that `y^2-kappa12` has coefficients coerced in `Qa12` and we make sure that it is indeed irreducible in `Qa12` (i.e. we make sure that `kappa12` is not the square of an element of `Qa12`).
You may notice immediately that my for-loop is a rather clumsy translation of the corresponding loop in the MAGMA code. I was hoping that SAGE would "remember" the previous value of `subOrderK`, thus having the same effect as the MAGMA-command `pMaximalOrder(subOrderK,p)`. However, my problem arises even earlier than that:
the number computed by `subOrderK.discriminant()` is absurdly huge - too big, in fact, for there to be any hope to factorise it in any reasonable amount of time.
The obvious alternative of simply writing
L.<c> = Qa12.extension(y^2-kappa12)
L.<alpha> = L.absolute_field()
OOK = L.maximal_order()
is also extremely time-intensive; I have not yet seen this finish.
I was hoping someone could help either with improving my code, or with a radically different approach to the problem.
NOTE: Though I have tried to make this question understandable, if some parts remain opaque, please do say so. I'll do my best to correct it. Leonhard MoosbruggerSat, 04 Aug 2012 11:33:43 +0200https://ask.sagemath.org/question/9203/