Sage: Ticket #5355: QQbar should have a coercion from number fields with embedding
https://trac.sagemath.org/ticket/5355
<p>
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:
</p>
<pre class="wiki">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?
</pre><p>
Currently, this map can already be created using <code>K.hom([QQbar(a)])</code> (see <a class="closed ticket" href="https://trac.sagemath.org/ticket/13041" title="defect: Conversion of number field elements to algebraic numbers (closed: fixed)">#13041</a>).
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/5355
Trac 1.1.6cremonaWed, 20 May 2009 19:54:04 GMT
https://trac.sagemath.org/ticket/5355#comment:1
https://trac.sagemath.org/ticket/5355#comment:1
<p>
This should not be hard. Here is what I propose:
</p>
<ul><li>Given a number field K and an emebedding of K into RR or CC, return the corresponding embedding of K into QQbar. This just requires selecting from K.embeddings(QQbar) the one which maps K.gen() to the element of QQbar closest to the image of K.gen() under the given embedding. As a variation, if the given embedding was into RR then the output could be an embedding into AA>
</li></ul><ul><li>As a default we could give no embedding and then use K.gen().complex_embedding() instead.
</li></ul><p>
Using the default there would be a coercion possible from K to QQbar; but the first version would allow the user flexibility.
</p>
TicketmmezzarobbaSun, 16 Feb 2014 14:12:09 GMTupstream set
https://trac.sagemath.org/ticket/5355#comment:2
https://trac.sagemath.org/ticket/5355#comment:2
<ul>
<li><strong>upstream</strong>
set to <em>N/A</em>
</li>
</ul>
<p>
Related: <a class="new ticket" href="https://trac.sagemath.org/ticket/12715" title="defect: Number field embeddings should go via AA and QQbar (new)">#12715</a>
</p>
TicketvdelecroixFri, 11 Mar 2016 20:24:36 GMT
https://trac.sagemath.org/ticket/5355#comment:3
https://trac.sagemath.org/ticket/5355#comment:3
<p>
We do have
</p>
<pre class="wiki">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
</pre><p>
Isn't it enough? What should be simplified is to automatized the embedding into <code>AA</code>/<code>QQbar</code>. And it is more or less the purpose of <a class="needs_work ticket" href="https://trac.sagemath.org/ticket/19356" title="enhancement: QQbar.polynomial_root(): allow approximate root (needs_work)">#19356</a>.
</p>
TicketpbruinFri, 09 Nov 2018 13:49:02 GMTdescription changed
https://trac.sagemath.org/ticket/5355#comment:4
https://trac.sagemath.org/ticket/5355#comment:4
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/5355?action=diff&version=4">diff</a>)
</li>
</ul>
TicketjipilabMon, 22 Apr 2019 13:48:56 GMTkeywords set
https://trac.sagemath.org/ticket/5355#comment:5
https://trac.sagemath.org/ticket/5355#comment:5
<ul>
<li><strong>keywords</strong>
<em>qqbar</em> <em>coercion</em> added
</li>
</ul>
TicketnbruinMon, 22 Apr 2019 20:44:38 GMT
https://trac.sagemath.org/ticket/5355#comment:6
https://trac.sagemath.org/ticket/5355#comment:6
<p>
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.
</p>
TicketmkoeppeMon, 22 Apr 2019 22:42:18 GMT
https://trac.sagemath.org/ticket/5355#comment:7
https://trac.sagemath.org/ticket/5355#comment:7
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/5355#comment:3" title="Comment 3">vdelecroix</a>:
</p>
<blockquote class="citation">
<p>
We do have
</p>
<pre class="wiki">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
</pre><p>
Isn't it enough? What should be simplified is to automatized the embedding into <code>AA</code>/<code>QQbar</code>. And it is more or less the purpose of <a class="needs_work ticket" href="https://trac.sagemath.org/ticket/19356" title="enhancement: QQbar.polynomial_root(): allow approximate root (needs_work)">#19356</a>.
</p>
</blockquote>
<p>
To automate the embedding, what should be the interface, perhaps something like this?
</p>
<pre class="wiki">K.<a> = NumberField(x^3 - 7, embedding=1.9, embedding_field=AA)
</pre>
Ticket