On Jan 11, 7:19 am, javier <vengor...@gmail.com> wrote: [...] > I have been trying some code to convert elements of gap finite fields > into the corresponding elements of sage finite fields. The sort of > straightforward manner fails because of this behavior: > > sage: a = gap("Z(2^4)") > sage: a^5 > Z(2^2) > > and apparently sage has no way of coercing finite fields into bigger > finite fields (in this example a coercion map from GF(4) to GF(16) > would send z4 to z16^5): [...] > TypeError: unable to coerce from a finite field other than the prime > subfield I reckon this must be due to Sage representing the finite field of order p^n as quotient rings F_p[x]/(f(x)), with f an irreducible polynomial of degree n. Indeed, in this case to do the coercion to, say F_{p^m}=F_p [x]/(g(x)), (with n dividing m, of course) would require some nontrivial (and slow) polynomial arithmetic, unless f and g are somehow "related".
GAP does it in a more clever way, at least for its "standard" finite fields; f and g are always related in such a way that such a computation is trivial. Namely, the primitive element Z(p^n) of the 1st field equals Z(p^m)^((p^m-1)/(p^n-1)), where Z(p^m) is the primitive element of the 2nd field. > > I can find a way around this by parsing the GAP strings with a lot of > care, but that is going to be an ugly piece of code and I'd rather > avoid it. Is there an easy way of getting the coercion maps for finite > fields, or maybe a way of regularizing the GAP output so that > everything is written in terms of the generator? for the latter, hopefully the remark above is useful. Dmitrii > > Cheers > J
-- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org