Opened 9 years ago

# Number field embeddings should go via AA and QQbar

Reported by: Owned by: davidloeffler davidloeffler major sage-6.4 number fields qqbar coercion N/A

### Description

Sage has a very nice module for the fields of algebraic numbers and algebraic real numbers (defined internally by a number field element and a choice of embedding).

This is almost tautologically the right target for real/complex embeddings of number fields, but at the moment it is *impossible* to create such embeddings -- the target is silently changed to the real/complex "lazy" fields in ` sage.rings.real_lazy `, which do not (and should not) coerce to AA / QQbar.

```sage: K.<a> = NumberField(x^3 - x - 1, embedding = AA(1))
sage: K.coerce_embedding()
Generic morphism:
From: Number Field in a with defining polynomial x^3 - x - 1
To:   Real Lazy Field
Defn: a -> 1.324717957244746?
sage: AA.has_coerce_map_from(K)
```

The above code should clearly return an embedding into AA; and more generally any embedding into any real field should be automagically refined to one into AA (not into RLF)

### comment:1 Changed 9 years ago by davidloeffler

• Type changed from PLEASE CHANGE to defect

### comment:2 Changed 8 years ago by robharron

Just wanted to point out that actually it is possible, though slightly roundabout, to create such embeddings.

```sage: x = polygen(QQ)
sage: f = x^3 - x -1
sage: r = f.roots(AA)[0][0]
sage: K.<a> = NumberField(x^3 - x - 1, embedding = r)
sage: K.coerce_embedding()
Generic morphism:
From: Number Field in a with defining polynomial x^3 - x - 1
To:   Algebraic Real Field
Defn: a -> 1.324717957244746?
```

If you look at the code that produces the embedding (create_embedding_from_approx(K, gen_image) in number_field_morphisms.pyx) you see that it chooses a lazy embedding if gen_image.parent() is not exact (which is not the case here) *or* gen_image is not a root of the defining polynomial of K. The latter is the case in your example. Perhaps sage is calling you lazy for passing it an approximation to the root! Joking aside I think it would be a capital idea to have AA as the codomain rather than RLF. One way to accomplish this would be to take replace gen_name with AA(gen_name.exact_rational()) (and analogously for the real and imaginary parts if gen_name is complex) and replace RLF with AA. Sound good?

It would probably also make sense to do this with the Minkowski_embedding function (though maybe that would follow from this change?).

Last edited 8 years ago by robharron (previous) (diff)

### comment:3 Changed 7 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

### comment:4 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

Related: #5355

### comment:6 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:7 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

### comment:8 Changed 5 years ago by vdelecroix

Related: #19356

Note: See TracTickets for help on using tickets.