embedding of number field element encapseled in symbolic ring

68 views
Skip to first unread message

Daniel Krenn

unread,
Jan 5, 2017, 4:55:23 AM1/5/17
to sage-s...@googlegroups.com
I want to take an number field element embedded in the symbolic ring
like the imaginary I and add it to an algebraic number:
sage: I.pyobject() + QQbar(sqrt(2))
This results in
TypeError: unsupported operand parent(s) for '+': 'Number Field in I
with defining polynomial x^2 + 1' and 'Algebraic Field'
as there is no *canonical* coercion as no embedding of the number field
is specified.

How can I specify this embedding such that it is used e.g. for the
symbolic I?

I've tried
sage: F = NumberField(x^2 + 1, 'i', embedding=QQbar(I))
which makes
sage: F.0 + QQbar(sqrt(2))
1.414213562373095? + 1*I
work. However,
sage: SR(F.0)
I
so it is converted to the existing I and the example at the top
sage: SR(F.0).pyobject() + QQbar(sqrt(2))
fails again.

Daniel

Daniel Krenn

unread,
Jan 5, 2017, 5:29:44 AM1/5/17
to sage-s...@googlegroups.com
On 2017-01-05 10:55, Daniel Krenn wrote:
> as there is no *canonical* coercion as no embedding of the number field
> is specified.
>
> How can I specify this embedding such that it is used e.g. for the
> symbolic I?

This looks weird: I is defined in sage.libs.pynac.pynac via
K = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')
pynac_I = K.gen()
so there is an embedding defined, but QQbar this seems to be not
sufficient to recognize it as an embedding into QQbar.

How can this be fixed?

Daniel Krenn

unread,
Jan 5, 2017, 5:33:17 AM1/5/17
to sage-s...@googlegroups.com
It seems like the embedding is simply ignored in some sense:
sage: QQbar(QuadraticField(-1, 'I', embedding=-CC.gen()).gen())
I
whereas
sage: CC(QuadraticField(-1, 'I', embedding=-CC.gen()).gen())
-1.00000000000000*I

Dima Pasechnik

unread,
Jan 5, 2017, 6:03:57 AM1/5/17
to sage-support
to me this looks an unimplemented feature of SR; basically, you want SR to be able to manipulate
algebraic numbers with a specified embedding in the same ring with transcendental functions.
(perhaps Mathematica does support this, although I'm not 100% sure)

Vincent Delecroix

unread,
Jan 7, 2017, 5:09:19 AM1/7/17
to sage-s...@googlegroups.com
Le 05/01/2017 à 11:33, Daniel Krenn a écrit :
> On 2017-01-05 11:29, Daniel Krenn wrote:
>> On 2017-01-05 10:55, Daniel Krenn wrote:
>>> as there is no *canonical* coercion as no embedding of the number field
>>> is specified.
>>>
>>> How can I specify this embedding such that it is used e.g. for the
>>> symbolic I?
>>
>> This looks weird: I is defined in sage.libs.pynac.pynac via
>> K = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')
>> pynac_I = K.gen()
>> so there is an embedding defined, but QQbar this seems to be not
>> sufficient to recognize it as an embedding into QQbar.
>
> It seems like the embedding is simply ignored in some sense:
> sage: QQbar(QuadraticField(-1, 'I', embedding=-CC.gen()).gen())
> I

To my mind, this one should actually raise an error. The proper way to
declare an embedding in QQbar is via

sage: K = QuadraticField(-1, 'I', embedding=-QQbar(I))
sage: K.0
I
sage: QQbar(K.0)
-I

which works perfectly fine.

Vincent

Daniel Krenn

unread,
Jan 8, 2017, 3:32:51 AM1/8/17
to sage-s...@googlegroups.com
On 2017-01-07 11:09, Vincent Delecroix wrote:
> Le 05/01/2017 à 11:33, Daniel Krenn a écrit :
>> It seems like the embedding is simply ignored in some sense:
>> sage: QQbar(QuadraticField(-1, 'I', embedding=-CC.gen()).gen())
>> I
>
> To my mind, this one should actually raise an error.

Ok.

> The proper way to
> declare an embedding in QQbar is via
>
> sage: K = QuadraticField(-1, 'I', embedding=-QQbar(I))
> sage: K.0
> I
> sage: QQbar(K.0)
> -I
>
> which works perfectly fine.

Is it possible to define one embedding from a number field into CC and
another into QQbar (at "the same time")?

Daniel

Nils Bruin

unread,
Jan 8, 2017, 1:04:52 PM1/8/17
to sage-support
On Sunday, January 8, 2017 at 12:32:51 AM UTC-8, Daniel Krenn wrote:

Is it possible to define one embedding from a number field into CC and
another into QQbar (at "the same time")?

No. A field only has one slot for an embedding. This restriction doesn't have good technical grounds for existing. It does make it a tiny bit harder to introduce inconsistencies in the coercion graph, though.

If a field embeds into QQbar, then there should be an implied coercion into CC, though: QQbar as implemented in sage is a subfield of the field of complex numbers (as you can see from how the elements print). And indeed this works:

sage: K.<a>=NumberField(x^3-2,embedding=QQbar(2^(1/3)))
sage: a+CC(1)
2.25992104989487

Marc Mezzarobba

unread,
Jan 9, 2017, 5:25:55 AM1/9/17
to sage-s...@googlegroups.com
Nils Bruin wrote:
> If a field embeds into QQbar, then there should be an implied coercion
> into CC, though: QQbar as implemented in sage is a subfield of the
> field of complex numbers (as you can see from how the elements print).

Let me add that there are long-standing tickets (#5355, #12715) for
making number field embeddings go into AA/QQbar instead of RR/CC. Quite
a bit of progress has been made towards that goal, but we're not quite
there yet.

--
Marc

Reply all
Reply to author
Forward
0 new messages