QQbar bug

3 views
Skip to first unread message

Alex Raichev

unread,
Nov 25, 2008, 7:51:59 PM11/25/08
to sage-support
Hi all:

I think i found a small bug relating to QQbar, the algebraic closure
of the rationals.

------------------------------------------------------------------------------------
| Sage Version 3.2, Release Date:
2008-11-20 |
| Type notebook() for the GUI, and license() for information. |
------------------------------------------------------------------------------------

sage: F.<a>= NumberField(x^2-2)
sage: a^2
2
sage: a^2 in QQ
True
sage: a^2 in QQbar
False
sage: 2 in QQbar
True

Alex

Simon King

unread,
Nov 26, 2008, 5:30:26 AM11/26/08
to sage-support
Hi!

On Nov 26, 1:51 am, Alex Raichev <tortoise.s...@gmail.com> wrote:
> sage: F.<a>= NumberField(x^2-2)
> sage: a^2
> 2
> sage: a^2 in QQ
> True
> sage: a^2 in QQbar
> False
> sage: 2 in QQbar
> True

A related observation:
sage: F.<a>=NumberField(x^2-2)
sage: QQ.is_subring(F)
True
sage: F.is_subring(QQbar)
False

Cheers,
Simon

mabshoff

unread,
Nov 26, 2008, 5:34:00 AM11/26/08
to sage-support
Simon,

please open a ticket. I would guess as you did that those two related.

Hopefully Carl will have some insight what is going on there.

Cheers,

Michael

Robert Bradshaw

unread,
Nov 26, 2008, 5:34:25 AM11/26/08
to sage-s...@googlegroups.com

This one should be false as QQbar comes with an embedding into CC,
but F does not (in other words, there is no canonical embedding of F
into QQbar). The a^2 in QQbar is a bug though.

- Robert

Simon King

unread,
Nov 26, 2008, 6:30:06 AM11/26/08
to sage-support
Dear Michael,

On Nov 26, 11:34 am, mabshoff <Michael.Absh...@mathematik.uni-
dortmund.de> wrote:
> please open a ticket. I would guess as you did that those two related.

Done, it is # 4621.

By the way, the above problem appears even more directly:
sage: F.<a>= NumberField(x^2-2)
sage: 2 in QQbar
True
sage: F(2) in QQbar
False

Although F has no canonical embedding into QQbar, my understanding is
that there is a hopefully unique maximal subfield of F that does have
a canonical embedding into QQbar. If this is correct, there could be a
method F.max_subfield_coercing_into(QQbar), and since F(2) is in that
subfield, one has a reason to expect `F(2) in QQbar` to be True.

Best regards,
Simon

Robert Bradshaw

unread,
Nov 26, 2008, 3:31:45 PM11/26/08
to sage-s...@googlegroups.com

On Nov 26, 2008, at 3:30 AM, Simon King wrote:

>
> Dear Michael,
>
> On Nov 26, 11:34 am, mabshoff <Michael.Absh...@mathematik.uni-
> dortmund.de> wrote:
>> please open a ticket. I would guess as you did that those two
>> related.
>
> Done, it is # 4621.
>
> By the way, the above problem appears even more directly:
> sage: F.<a>= NumberField(x^2-2)
> sage: 2 in QQbar
> True
> sage: F(2) in QQbar
> False
>
> Although F has no canonical embedding into QQbar, my understanding is
> that there is a hopefully unique maximal subfield of F that does have
> a canonical embedding into QQbar.

Into the mathematical \bar{Q}, yet. Sage's QQbar is \bar{Q} with a
choice of embedding into \C, and as F does not have a (chosen)
embedding into \C it doesn't have a chosen embedding into QQbar.

> If this is correct, there could be a
> method F.max_subfield_coercing_into(QQbar), and since F(2) is in that
> subfield, one has a reason to expect `F(2) in QQbar` to be True.


One *does* expect F(2) to be in QQbar, the same that one expects the
rational number 4/2 to be in ZZ, so I agree that the above is a bug.

- Robert

John Cremona

unread,
Nov 28, 2008, 7:15:54 AM11/28/08
to sage-support


On Nov 26, 8:31 pm, Robert Bradshaw <rober...@math.washington.edu>
wrote:
sage: F.<a>=NumberField(x^2-2)
sage: F.embeddings(QQbar)

[
Ring morphism:
From: Number Field in a with defining polynomial x^2 - 2
To: Algebraic Field
Defn: a |--> -1.414213562373095?,
Ring morphism:
From: Number Field in a with defining polynomial x^2 - 2
To: Algebraic Field
Defn: a |--> 1.414213562373095?
]

Is the problem that there is more than one embedding of F into QQbar?
Of course, the image of 2 will be the same with each:

sage: twos = [f(2) for f in F.embeddings(QQbar)]
sage: twos
[2, 2]
sage: twos[0] == twos[1]
True

But note that this crashes horribly:
sage: twos[1] == 2
True
sage: twos[1] == F(2)
---------------------------------------------------------------------------
TypeError (etc)
> - Robert

Robert Bradshaw

unread,
Nov 28, 2008, 1:13:00 PM11/28/08
to sage-s...@googlegroups.com

Yep. Note that once that number field coercion code gets merged,
QuadraticField(2) will have a preferred embedding into CC, and hence
QQbar.

> Of course, the image of 2 will be the same with each:
>
> sage: twos = [f(2) for f in F.embeddings(QQbar)]
> sage: twos
> [2, 2]
> sage: twos[0] == twos[1]
> True
>
> But note that this crashes horribly:
> sage: twos[1] == 2
> True
> sage: twos[1] == F(2)
> ----------------------------------------------------------------------
> -----
> TypeError (etc)

Yep. One just needs to fix the __call__ method of QQbar.

- Robert


Reply all
Reply to author
Forward
0 new messages