# Homset for Finite Fields¶

This is the set of all field homomorphisms between two finite fields.

EXAMPLES:

sage: R.<t> = ZZ[]
sage: E.<a> = GF(25, modulus = t^2 - 2)
sage: F.<b> = GF(625)
sage: H = Hom(E, F)
sage: f = H([4*b^3 + 4*b^2 + 4*b]); f
Ring morphism:
From: Finite Field in a of size 5^2
To:   Finite Field in b of size 5^4
Defn: a |--> 4*b^3 + 4*b^2 + 4*b
sage: f(2)
2
sage: f(a)
4*b^3 + 4*b^2 + 4*b
sage: len(H)
2
sage: [phi(2*a)^2 for phi in Hom(E, F)]
[3, 3]


We can also create endomorphisms:

sage: End(E)
Automorphism group of Finite Field in a of size 5^2
sage: End(GF(7))[0]
Ring endomorphism of Finite Field of size 7
Defn: 1 |--> 1
sage: H = Hom(GF(7), GF(49, 'c'))
sage: H[0](2)
2

class sage.rings.finite_rings.homset.FiniteFieldHomomorphism_im_gens

EXAMPLES:

sage: R.<x,y> = QQ[]
sage: phi = R.hom([x,x+y]); phi
Ring endomorphism of Multivariate Polynomial Ring in x, y over Rational Field
Defn: x |--> x
y |--> x + y
sage: type(phi)
<type 'sage.rings.morphism.RingHomomorphism_im_gens'>


Here’s another example where the domain isn’t free:

sage: S.<xx,yy> = R.quotient(x - y)
sage: phi = S.hom([xx+1,xx+1])


Note that one has to specify valid images:

sage: phi = S.hom([xx+1,xx-1])
Traceback (most recent call last):
...
TypeError: images do not define a valid homomorphism


There is a check option, but it may be ignored in some cases – it’s purpose isn’t so you can lie to Sage, but to sometimes speed up creation of a homomorphism:

sage: phi = S.hom([xx+1,xx-1],check=False)
Traceback (most recent call last):
...
TypeError: images do not define a valid homomorphism

class sage.rings.finite_rings.homset.FiniteFieldHomset(R, S, category=None)

Set of homomorphisms with domain a given finite field.

index(item)

Return the index of self.

EXAMPLES:

sage: K.<z> = GF(1024)
sage: g = End(K)[3]
sage: End(K).index(g) == 3
True

is_aut()

Check if self is an automorphism

EXAMPLES:

sage: Hom(GF(4, 'a'), GF(16, 'b')).is_aut()
False
sage: Hom(GF(4, 'a'), GF(4, 'c')).is_aut()
False
sage: Hom(GF(4, 'a'), GF(4, 'a')).is_aut()
True

list()

Return a list of all the elements in this set of field homomorphisms.

EXAMPLES:

sage: K.<a> = GF(25)
sage: End(K)
Automorphism group of Finite Field in a of size 5^2
sage: list(End(K))
[Ring endomorphism of Finite Field in a of size 5^2
Defn: a |--> 4*a + 1,
Ring endomorphism of Finite Field in a of size 5^2
Defn: a |--> a]
sage: L.<z> = GF(7^6)
sage: [g for g in End(L) if (g^3)(z) == z]
[Ring endomorphism of Finite Field in z of size 7^6
Defn: z |--> 5*z^4 + 5*z^3 + 4*z^2 + 3*z + 1,
Ring endomorphism of Finite Field in z of size 7^6
Defn: z |--> 3*z^5 + 5*z^4 + 5*z^2 + 2*z + 3,
Ring endomorphism of Finite Field in z of size 7^6
Defn: z |--> z]


TESTS:

Check that trac ticket #11390 is fixed:

sage: K = GF(1<<16,'a'); L = GF(1<<32,'b')
sage: K.Hom(L)[0]
Ring morphism:
From: Finite Field in a of size 2^16
To:   Finite Field in b of size 2^32
Defn: a |--> b^29 + b^27 + b^26 + b^23 + b^21 + b^19 + b^18 + b^16 + b^14 + b^13 + b^11 + b^10 + b^9 + b^8 + b^7 + b^6 + b^5 + b^2 + b

order()

Return the order of this set of field homomorphisms.

EXAMPLES:

sage: K.<a> = GF(125)
sage: End(K)
Automorphism group of Finite Field in a of size 5^3
sage: End(K).order()
3
sage: L.<b> = GF(25)
sage: Hom(L, K).order() == Hom(K, L).order() == 0
True


#### Previous topic

Finite Prime Fields