Hi Evrim!

On 2015-05-18, Simon King <[email protected]> wrote:
> I did some tests, and found that I could not construct *any* isomorphism
> of field extensions. Does anyone know how to construct an isomorphism
> between GF(8,'a') and GF(8,'h') leaving the prime field invariant?

Aha! This is how it works:

sage: from sage.rings.finite_rings.hom_finite_field import 
FiniteFieldHomomorphism_generic
sage: phi = FiniteFieldHomomorphism_generic(Hom(K1,K2)); phi
Ring morphism:
  From: Finite Field in a of size 2^3
  To:   Finite Field in h of size 2^3
  Defn: a |--> h
sage: R1.<x> = K1[]
sage: R2.<l0, l1, l2, f0, f1, f2, f3, f4, f5, f6, f7, b0, b1, b2, b3, x, y> = 
K2[]
sage: f = R1.random_element()
sage: f
(a^2 + 1)*x^2 + (a + 1)*x + a + 1
sage: K2.register_coercion(phi)
sage: R2(f)
(h^2 + 1)*x^2 + (h + 1)*x + (h + 1)

Note, however, that the above solution is a bit dangerous. Registering a
coercion map after creation of an object can have severe implications for
the stability of a Sage session.

Here is how you can create a conversion homomorphism:

sage: F, R = R2.construction()
sage: F   # This is a functor of rings that creates a polynomial ring
MPoly[l0,l1,l2,f0,f1,f2,f3,f4,f5,f6,f7,b0,b1,b2,b3,x,y]

One can apply the functor F to the morphism phi:

sage: psi = F(phi); psi
Ring morphism:
  From: Multivariate Polynomial Ring in l0, l1, l2, f0, f1, f2, f3, f4, f5, f6, 
f7, b0, b1, b2, b3, x, y over Finite Field in a of size 2^3
  To:   Multivariate Polynomial Ring in l0, l1, l2, f0, f1, f2, f3, f4, f5, f6, 
f7, b0, b1, b2, b3, x, y over Finite Field in h of size 2^3
  Defn: Induced from base ring by
        Ring morphism:
          From: Finite Field in a of size 2^3
          To:   Finite Field in h of size 2^3
          Defn: a |--> h

And then one can apply the resulting induced homomorphism to an element
of R1 (conversion from R1 to the domain of psi is implicit):

sage: f = R1.random_element()
sage: f
a*x + a^2 + 1
sage: psi(f)
(h)*x + (h^2 + 1)

In summary:

- There are ways to make the conversion automatic, but I would recommend
  against it (perhaps it is safer to use K2.register_conversion instead
  of K2.register_coercion?)
- You can obtain a homomorphism and use it explicitly for conversion.
  Depending on the application, this solution is preferred.

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to