You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trac #15331: Do not try to create embedded number field morphisms for non-embedded number fields
The attempt to create an embedded number field morphisms for non-
embedded number fields currently fails (and should of course fail).
{{{
sage: L.<i> = NumberField(x^2 + 1)
sage: K = NumberField(L(i/2+3).minpoly(), names=('i0',),
embedding=L(i/2+3))
sage: from sage.rings.number_field import number_field_morphisms
sage: number_field_morphisms.EmbeddedNumberFieldMorphism(R, self)
Traceback (most recent call last):
...
RuntimeError: maximum recursion depth exceeded in __instancecheck__
}}}
However, instead of running into an infinite recursion, a quick and
simple `ValueError` (or perhaps `TypeError`) should be raised.
URL: http://trac.sagemath.org/15331
Reported by: SimonKing
Ticket author(s): Simon King, Marc Mezzarobba, Jean-Pierre Flori
Reviewer(s): Marc Mezzarobba, Jean-Pierre Flori
from sage.rings.real_mpfr import RealField, mpfr_prec_min
29
31
from sage.rings.complex_field import ComplexField
@@ -107,8 +109,16 @@ cdef class NumberFieldEmbedding(Morphism):
107
109
cdef class EmbeddedNumberFieldMorphism(NumberFieldEmbedding):
108
110
r"""
109
111
This allows one to go from one number field in another consistently,
110
-
assuming they both have specified embeddings into an ambient field
111
-
(by default it looks for an embedding into `\CC`).
112
+
assuming they both have specified embeddings into an ambient field.
113
+
114
+
If no ambient field is supplied, then the following ambient fields are
115
+
tried:
116
+
117
+
* the pushout of the fields where the number fields are embedded;
118
+
119
+
* the algebraic closure of the previous pushout;
120
+
121
+
* `\CC`.
112
122
113
123
EXAMPLES::
114
124
@@ -161,15 +171,46 @@ cdef class EmbeddedNumberFieldMorphism(NumberFieldEmbedding):
161
171
Traceback (most recent call last):
162
172
...
163
173
TypeError: unsupported operand parent(s) for '+': 'Number Field in a with defining polynomial x^3 + 2' and 'Number Field in a with defining polynomial x^3 + 2'
174
+
175
+
The following was fixed to raise a ``TypeError`` in :trac:`15331`::
176
+
177
+
sage: L.<i> = NumberField(x^2 + 1)
178
+
sage: K = NumberField(L(i/2+3).minpoly(), names=('i0',), embedding=L(i/2+3))
179
+
sage: EmbeddedNumberFieldMorphism(K, L)
180
+
Traceback (most recent call last):
181
+
...
182
+
TypeError: No embedding available for Number Field in i with defining polynomial x^2 + 1
0 commit comments