Embeddings into ambient fields

Embeddings into ambient fields

This module provides classes to handle embeddings of number fields into ambient fields (generally \(\RR\) or \(\CC\)).

class sage.rings.number_field.number_field_morphisms.CyclotomicFieldEmbedding

Bases: sage.rings.number_field.number_field_morphisms.NumberFieldEmbedding

Specialized class for converting cyclotomic field elements into a cyclotomic field of higher order. All the real work is done by _lift_cyclotomic_element.

class sage.rings.number_field.number_field_morphisms.EmbeddedNumberFieldConversion

Bases: sage.categories.map.Map

This allows one to cast one number field in another consistently, assuming they both have specified embeddings into an ambient field (by default it looks for an embedding into \(\CC\)).

This is done by factoring the minimal polynomial of the input in the number field of the codomain. This may fail if the element is not actually in the given field.

ambient_field
class sage.rings.number_field.number_field_morphisms.EmbeddedNumberFieldMorphism

Bases: sage.rings.number_field.number_field_morphisms.NumberFieldEmbedding

This allows one to go from one number field in another consistently, assuming they both have specified embeddings into an ambient field.

If no ambient field is supplied, then the following ambient fields are tried:

  • the pushout of the fields where the number fields are embedded;
  • the algebraic closure of the previous pushout;
  • \(\CC\).

EXAMPLES:

sage: K.<i> = NumberField(x^2+1,embedding=QQbar(I))
sage: L.<i> = NumberField(x^2+1,embedding=-QQbar(I))
sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldMorphism
sage: EmbeddedNumberFieldMorphism(K,L,CDF)
Generic morphism:
  From: Number Field in i with defining polynomial x^2 + 1
  To:   Number Field in i with defining polynomial x^2 + 1
  Defn: i -> -i
sage: EmbeddedNumberFieldMorphism(K,L,QQbar)
Generic morphism:
  From: Number Field in i with defining polynomial x^2 + 1
  To:   Number Field in i with defining polynomial x^2 + 1
  Defn: i -> -i
ambient_field
section()

EXAMPLES:

sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldMorphism
sage: K.<a> = NumberField(x^2-700, embedding=25)
sage: L.<b> = NumberField(x^6-700, embedding=3)
sage: f = EmbeddedNumberFieldMorphism(K, L)
sage: f(2*a-1)
2*b^3 - 1
sage: g = f.section()
sage: g(2*b^3-1)
2*a - 1
class sage.rings.number_field.number_field_morphisms.NumberFieldEmbedding

Bases: sage.categories.morphism.Morphism

If R is a lazy field, the closest root to gen_embedding will be chosen.

EXAMPLES:

sage: x = polygen(QQ)
sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
sage: K.<a> = NumberField(x^3-2)
sage: f = NumberFieldEmbedding(K, RLF, 1)
sage: f(a)^3
2.00000000000000?
sage: RealField(200)(f(a)^3)
2.0000000000000000000000000000000000000000000000000000000000

sage: sigma_a = K.polynomial().change_ring(CC).roots()[1][0]; sigma_a
-0.62996052494743... - 1.09112363597172*I
sage: g = NumberFieldEmbedding(K, CC, sigma_a)
sage: g(a+1)
0.37003947505256... - 1.09112363597172*I
gen_image()

Returns the image of the generator under this embedding.

EXAMPLES:

sage: f = QuadraticField(7, 'a', embedding=2).coerce_embedding()
sage: f.gen_image()
2.645751311064591?
sage.rings.number_field.number_field_morphisms.closest(target, values, margin=1)

This is a utility function that returns the item in values closest to target (with respect to the code{abs} function). If margin is greater than 1, and x and y are the first and second closest elements to target, then only return x if x is margin times closer to target than y, i.e. margin * abs(target-x) < abs(target-y).

TESTS:

sage: from sage.rings.number_field.number_field_morphisms import closest
sage: closest(1.2, [0,1,2,3,4])
1
sage: closest(1.7, [0,1,2,3,4])
2
sage: closest(1.7, [0,1,2,3,4], margin=5)
sage: closest(1.9, [0,1,2,3,4], margin=5)
2
sage: closest(.2, [-1, 1, CDF.0, -CDF.0])
1
sage.rings.number_field.number_field_morphisms.create_embedding_from_approx(K, gen_image)

This creates a morphism into from K into the parent of gen_image, choosing as the image of the generator the closest root to gen_image in its parent.

If gen_image is in a real or complex field, then it creates an image into a lazy field.

EXAMPLES:

sage: from sage.rings.number_field.number_field_morphisms import create_embedding_from_approx
sage: K.<a> = NumberField(x^3-x+1/10)
sage: create_embedding_from_approx(K, 1)
Generic morphism:
  From: Number Field in a with defining polynomial x^3 - x + 1/10
  To:   Real Lazy Field
  Defn: a -> 0.9456492739235915?
sage: create_embedding_from_approx(K, 0)
Generic morphism:
  From: Number Field in a with defining polynomial x^3 - x + 1/10
  To:   Real Lazy Field
  Defn: a -> 0.10103125788101081?
sage: create_embedding_from_approx(K, -1)
Generic morphism:
  From: Number Field in a with defining polynomial x^3 - x + 1/10
  To:   Real Lazy Field
  Defn: a -> -1.046680531804603?

We can define embeddings from one number field to another:

sage: L.<b> = NumberField(x^6-x^2+1/10)
sage: create_embedding_from_approx(K, b^2)
Generic morphism:
  From: Number Field in a with defining polynomial x^3 - x + 1/10
  To:   Number Field in b with defining polynomial x^6 - x^2 + 1/10
  Defn: a -> b^2

The if the embedding is exact, it must be valid:

sage: create_embedding_from_approx(K, b)
Traceback (most recent call last):
...
ValueError: b is not a root of the defining polynomial of Number Field in a with defining polynomial x^3 - x + 1/10
sage.rings.number_field.number_field_morphisms.matching_root(poly, target, ambient_field=None, margin=1, max_prec=None)

Given a polynomial and a target, this function chooses the root that target best approximates as compared in ambient_field.

If the parent of target is exact, the equality is required, otherwise find closest root (with respect to the code{abs} function) in the ambient field to the target, and return the root of poly (if any) that approximates it best.

EXAMPLES:

sage: from sage.rings.number_field.number_field_morphisms import matching_root
sage: R.<x> = CC[]
sage: matching_root(x^2-2, 1.5)
1.41421356237310
sage: matching_root(x^2-2, -100.0)
-1.41421356237310
sage: matching_root(x^2-2, .00000001)
1.41421356237310
sage: matching_root(x^3-1, CDF.0)
-0.50000000000000... + 0.86602540378443...*I
sage: matching_root(x^3-x, 2, ambient_field=RR)
1.00000000000000

Previous topic

Morphisms between number fields

Next topic

Structure maps for number fields

This Page