@@ -277,6 +277,58 @@ def algebraic_closure(self):
277
277
"""
278
278
raise NotImplementedError ("algebraic closures of general fields not implemented" )
279
279
280
+ def an_embedding (self , K ):
281
+ r"""
282
+ Return some embedding of this field into another field `K`,
283
+ and raise a :class:`ValueError` if none exists.
284
+
285
+ EXAMPLES::
286
+
287
+ sage: GF(2).an_embedding(GF(4))
288
+ Ring morphism:
289
+ From: Finite Field of size 2
290
+ To: Finite Field in z2 of size 2^2
291
+ Defn: 1 |--> 1
292
+ sage: GF(4).an_embedding(GF(8))
293
+ Traceback (most recent call last):
294
+ ...
295
+ ValueError: no embedding from Finite Field in z2 of size 2^2 to Finite Field in z3 of size 2^3
296
+ sage: GF(4).an_embedding(GF(16))
297
+ Ring morphism:
298
+ From: Finite Field in z2 of size 2^2
299
+ To: Finite Field in z4 of size 2^4
300
+ Defn: z2 |--> z4^2 + z4
301
+
302
+ ::
303
+
304
+ sage: CyclotomicField(5).an_embedding(QQbar)
305
+ Coercion map:
306
+ From: Cyclotomic Field of order 5 and degree 4
307
+ To: Algebraic Field
308
+ sage: CyclotomicField(3).an_embedding(CyclotomicField(7))
309
+ Traceback (most recent call last):
310
+ ...
311
+ ValueError: no embedding from Cyclotomic Field of order 3 and degree 2 to Cyclotomic Field of order 7 and degree 6
312
+ sage: CyclotomicField(3).an_embedding(CyclotomicField(6))
313
+ Generic morphism:
314
+ From: Cyclotomic Field of order 3 and degree 2
315
+ To: Cyclotomic Field of order 6 and degree 2
316
+ Defn: zeta3 -> zeta6 - 1
317
+ """
318
+ if self .characteristic () != K .characteristic ():
319
+ raise ValueError (f'no embedding from { self } to { K } : incompatible characteristics' )
320
+
321
+ H = self .Hom (K )
322
+ try :
323
+ return H .natural_map ()
324
+ except TypeError :
325
+ pass
326
+ from sage .categories .sets_cat import EmptySetError
327
+ try :
328
+ return H .an_element ()
329
+ except EmptySetError :
330
+ raise ValueError (f'no embedding from { self } to { K } ' )
331
+
280
332
def prime_subfield (self ):
281
333
"""
282
334
Return the prime subfield of ``self``.
@@ -699,22 +751,6 @@ def vector_space(self, *args, **kwds):
699
751
"""
700
752
return self .free_module (* args , ** kwds )
701
753
702
- def _pseudo_fraction_field (self ):
703
- """
704
- The fraction field of ``self`` is always available as ``self``.
705
-
706
- EXAMPLES::
707
-
708
- sage: QQ._pseudo_fraction_field()
709
- Rational Field
710
- sage: K = GF(5)
711
- sage: K._pseudo_fraction_field()
712
- Finite Field of size 5
713
- sage: K._pseudo_fraction_field() is K
714
- True
715
- """
716
- return self
717
-
718
754
class ElementMethods :
719
755
def euclidean_degree (self ):
720
756
r"""
0 commit comments