If you want the order generated by a, you can do

sage: K.<a>=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, 2023 at 11:54 AM Nils Bruin <nbr...@sfu.ca> wrote:

> 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 isomorphism here.
>
> Mathematically, I think sage is right to have some reservation here. If we
> do
>
> sage: K.<a>=NumberField(x^4-2)
> sage: OK=K.ring_of_integers()
> sage: b=a^2
> sage: O=ZZ[b]
> sage: O.ambient()
> Number Field in a0 with defining polynomial x^2 - 2 with a0 = a^2
>
> I think you see the problem: the field of fractions of ZZ[b] does not need
> to be (and in the above example isn't) equal to the parent of b.
>
> In this case, O wouldn't have a finite index in OK.
>
> For programmatic consistency, we generally avoid programming in
> "shortcuts" based on specific values: while ZZ[a] happens to be an order in
> the parent K of a if a generates it over QQ, we'd generally *not* special
> case that to then create ZZ[a] as an order in K, but still create this
> separate field with generator a0.
>
> It's perhaps inconvenient and pedantic, but I would think this one may
> even still be on the instructive side for having to explain to a student.
>
> On Wednesday, 6 September 2023 at 17:21:12 UTC-7 Justin C. Walker wrote:
>
>> Hi, all,
>>
>> I think I understand what’s going wrong, but I don’t understand how to
>> fix the following problem:
>>
>> sage: K.<a>=NumberField(x^2-10)
>> sage: OK=K.maximal_order()
>> sage: O=ZZ[a]
>> sage: a in OK
>> True
>> sage: a in K
>> True
>> sage: a in O
>> True
>> sage: O.index_in(OK)
>>
>> ---------------------------------------------------------------------------
>> ValueError                                Traceback (most recent call
>> last)
>> ...Blooie
>> ValueError: other must have the same ambient number field as self.
>>
>> Have we just painted ourselves into a (figurative) corner?
>>
>> Pointers?  Suggestions?
>>
>> Thanks for any help.
>>
>> Justin
>>
>> --
>> Justin C. Walker, Curmudgeon at Large
>> Institute for the Absorption of Federal Funds
>> -----------
>> While creating wives, God promised men
>> that good and obedient wives would be
>> found in all corners of the world.
>> Then He made the earth round.
>> --
>>
>>
>>
>>
>>
>>
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/91b7f3ea-fd89-446e-8a26-3e474414d32cn%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/91b7f3ea-fd89-446e-8a26-3e474414d32cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAChs6_m%2BDdvtLUq5ouCEkNK6qo31upfkHqCLF_0R0DwTgmU1Nw%40mail.gmail.com.

Reply via email to