Opened 13 years ago
Last modified 3 years ago
#5355 new enhancement
QQbar should have a coercion from number fields with embedding
Reported by: | cwitty | Owned by: | cwitty |
---|---|---|---|
Priority: | major | Milestone: | sage-wishlist |
Component: | coercion | Keywords: | qqbar, coercion |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
If a number field comes with an embedding into the complex numbers, QQbar should allow coercions (or at least conversions) from that number field. For example:
sage: K.<a> = NumberField(x^3 - x + 1, embedding=-1.32) sage: QQbar.coerce_map_from(K) Ring morphism: From: Number Field in a with defining polynomial x^3 - x + 1 To: Algebraic Field Defn: a |--> -1.324717957244746?
Currently, this map can already be created using K.hom([QQbar(a)])
(see #13041).
Change History (7)
comment:1 Changed 13 years ago by
comment:3 follow-up: ↓ 7 Changed 6 years ago by
We do have
sage: K.<a> = NumberField(x^3 - 7, embedding=AA(7)**(1/3)) sage: AA.has_coerce_map_from(K) True sage: K.<a> = NumberField(x^3 - 7, embedding=QQbar(7)**(1/3) * QQbar.zeta(3)) sage: QQbar.has_coerce_map_from(K) True
Isn't it enough? What should be simplified is to automatized the embedding into AA
/QQbar
. And it is more or less the purpose of #19356.
comment:4 Changed 4 years ago by
- Description modified (diff)
comment:5 Changed 3 years ago by
- Keywords qqbar coercion added
comment:6 Changed 3 years ago by
There are memory-leak implications on this: Coercions are normally cached on the codomain (in this case QQbar). Having a coercion from a number field K to QQbar would imply a reference from QQbar to K. Some effort is made to not make that reference a strong one right from the start (this is why the coercion framework tries to use weak references to the domain), but you'd have to test this quite carefully. Thanks to the complicated interactions with the (weak) dictionaries, I expect that some indirect memory leaks would be introduced.
comment:7 in reply to: ↑ 3 Changed 3 years ago by
Replying to vdelecroix:
We do have
sage: K.<a> = NumberField(x^3 - 7, embedding=AA(7)**(1/3)) sage: AA.has_coerce_map_from(K) True sage: K.<a> = NumberField(x^3 - 7, embedding=QQbar(7)**(1/3) * QQbar.zeta(3)) sage: QQbar.has_coerce_map_from(K) TrueIsn't it enough? What should be simplified is to automatized the embedding into
AA
/QQbar
. And it is more or less the purpose of #19356.
To automate the embedding, what should be the interface, perhaps something like this?
K.<a> = NumberField(x^3 - 7, embedding=1.9, embedding_field=AA)
This should not be hard. Here is what I propose:
Using the default there would be a coercion possible from K to QQbar; but the first version would allow the user flexibility.