@@ -1871,6 +1871,12 @@ cdef class FiniteField(Field):
18711871 sage: F.gen(3)
18721872 z3
18731873
1874+ For finite fields, the algebraic closure is always (isomorphic
1875+ to) the algebraic closure of the prime field::
1876+
1877+ sage: GF(5^2).algebraic_closure() == F
1878+ True
1879+
18741880 The default name is 'z' but you can change it through the option
18751881 ``name``::
18761882
@@ -1890,13 +1896,18 @@ cdef class FiniteField(Field):
18901896
18911897 .. NOTE::
18921898
1893- This is currently only implemented for prime fields.
1899+ For non-prime finite fields, this method currently simply
1900+ returns the algebraic closure of the prime field. This may
1901+ or may not change in the future when extension towers are
1902+ supported properly.
18941903
18951904 TESTS::
18961905
18971906 sage: GF(5).algebraic_closure() is GF(5).algebraic_closure()
18981907 True
18991908 """
1909+ if not self .is_prime_field():
1910+ return self .prime_subfield().algebraic_closure()
19001911 from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField
19011912 return AlgebraicClosureFiniteField(self , name, ** kwds)
19021913
@@ -1920,6 +1931,76 @@ cdef class FiniteField(Field):
19201931 return (exists_conway_polynomial(p, n)
19211932 and self .polynomial() == self .polynomial_ring()(conway_polynomial(p, n)))
19221933
1934+ def an_embedding (self , K ):
1935+ r """
1936+ Return some embedding of this field into another field `K`,
1937+ and raise a :class:`ValueError` if none exists.
1938+
1939+ .. SEEALSO::
1940+
1941+ :meth:`sage. rings. ring. Field. an_embedding`
1942+
1943+ EXAMPLES::
1944+
1945+ sage: GF( 4,'a') . an_embedding( GF( 2) . algebraic_closure( ))
1946+ Ring morphism:
1947+ From: Finite Field in a of size 2^ 2
1948+ To: Algebraic closure of Finite Field of size 2
1949+ Defn: a | --> ...
1950+ """
1951+ if self .characteristic() != K.characteristic():
1952+ raise ValueError (f' no embedding from {self} to {K}: incompatible characteristics' )
1953+ try :
1954+ return super ().an_embedding(K)
1955+ except (NotImplementedError , ValueError ):
1956+ pass
1957+ if K not in FiniteFields():
1958+ from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField_generic
1959+ if not isinstance (K, AlgebraicClosureFiniteField_generic):
1960+ raise NotImplementedError (' computing embeddings into this ring not implemented' )
1961+ g = self .gen()
1962+ if (emb := K.coerce_map_from(self )) is not None :
1963+ return self .hom([emb(g)])
1964+ try :
1965+ r = g.minpoly().change_ring(K).any_root()
1966+ except ValueError :
1967+ raise ValueError (f' no embedding from {self} to {K}' )
1968+ return self .hom([r])
1969+
1970+ def embeddings (self , K ):
1971+ r """
1972+ Return a list of all embeddings of this field in another field `K`.
1973+
1974+ EXAMPLES::
1975+
1976+ sage: GF( 2) . embeddings( GF( 4))
1977+ [Ring morphism:
1978+ From: Finite Field of size 2
1979+ To: Finite Field in z2 of size 2^2
1980+ Defn: 1 |--> 1 ]
1981+ sage: GF( 4) . embeddings( GF( 2) . algebraic_closure( ))
1982+ [Ring morphism:
1983+ From: Finite Field in z2 of size 2^2
1984+ To: Algebraic closure of Finite Field of size 2
1985+ Defn: z2 |--> z2,
1986+ Ring morphism:
1987+ From: Finite Field in z2 of size 2^2
1988+ To: Algebraic closure of Finite Field of size 2
1989+ Defn: z2 |--> z2 + 1 ]
1990+ """
1991+ if self .characteristic() != K.characteristic():
1992+ return []
1993+ if K not in FiniteFields():
1994+ from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField_generic
1995+ if not isinstance (K, AlgebraicClosureFiniteField_generic):
1996+ raise NotImplementedError (' computing embeddings into this ring not implemented' )
1997+ g = self .gen()
1998+ rs = []
1999+ if (emb := K.coerce_map_from(self )) is not None :
2000+ rs.append(emb(g))
2001+ rs += [r for r,_ in g.minpoly().roots(ring = K) if r not in rs]
2002+ return [self .hom([r]) for r in rs]
2003+
19232004 def frobenius_endomorphism (self , n = 1 ):
19242005 """
19252006 INPUT:
0 commit comments