Re: [sage-devel] Re: Issue with orders in number fields

2023-09-07 Thread Nils Bruin
Hm, interesting. The current code for ZZ.__getitem__ (i.e., ZZ[a]) does this: if isinstance(x, NumberFieldElement_base): K, _ = parent(x).subfield(x) return K.order(K.gen()) However, this functionality is also available in K.order: sage: K.order(a,allow_subfield=

Re: [sage-devel] Re: Issue with orders in number fields

2023-09-07 Thread David Roe
If you want the order generated by a, you can do sage: K.=NumberField(x^2-10) sage: OK=K.maximal_order() sage: O = K.order(a) sage: O.index_in(OK) 1 Note that this correctly fails in Nils' example: sage: K.order(a^2) ... ValueError: the rank of the span of gens is wrong David On Thu, Sep 7, 202

[sage-devel] Re: Issue with orders in number fields

2023-09-07 Thread Nils Bruin
Hi Justin, You can see the problem from: sage: O.ambient() Number Field in a0 with defining polynomial x^2 - 10 with a0 = a As you can see, the ambient field of O is not identical to K (which is the ambient field of OK). It is a field with an *embedding* into K, though, and it happens to be an