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=True) Order in Number Field in a with defining polynomial x^4 - 2 sage: K.order(a^2,allow_subfield=True) Order in Number Field in beta with defining polynomial x^2 - 2*x - 1 with beta = -a^2 + 1 so the code could actually just be: if isinstance(x, NumberFieldElement_base): return K.order(x,allow_subfield=True) and then Justin's problem would be solved. It's more economical in that no (isomorphic) copy of the field is created. It looks like it does cause different problems, though: it looks like K.order wants a standardised basis, so: sage: K.order(a+1).gens() (1, a, a^2, a^3) sage: K.order(a^2+a+1).gens() (1, 7*a^3 + a, 2*a^3 + a^2, 9*a^3) So K.order(a) does not need to return an order with a power basis on a. Perhaps that's the deeper reason why ZZ[a] does its trickery: certainly one would expect an order with power basis on a from that construction. -- 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/24916bb3-be70-49fc-a278-1af859a0401fn%40googlegroups.com.