ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 04 Mar 2019 09:13:09 -0600i doesn't belong to QQbar ? Why ?http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/I do not understand this :
sage: sqrt(1) in QQbar
True
sage: sqrt(-2) in QQbar
True
sage: sqrt(-1) in QQbar
False
Can someone explain ?
Note that, however :
sage: [t[0] in QQbar for t in (x^2+1).roots(ring=QQbar)]
[True, True]Sun, 12 Nov 2017 13:55:13 -0600http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/Answer by Javidlg for <p>I do not understand this :</p>
<pre><code>sage: sqrt(1) in QQbar
True
sage: sqrt(-2) in QQbar
True
sage: sqrt(-1) in QQbar
False
</code></pre>
<p>Can someone explain ?</p>
<p>Note that, however :</p>
<pre><code>sage: [t[0] in QQbar for t in (x^2+1).roots(ring=QQbar)]
[True, True]
</code></pre>
http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?answer=43246#post-id-43246Still the same bug on SageMath version 8.2, Release Date: 2018-05-05 . Nobody fix this? 0.0Fri, 03 Aug 2018 07:46:47 -0500http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?answer=43246#post-id-43246Comment by Javidlg for <p>Still the same bug on SageMath version 8.2, Release Date: 2018-05-05 . Nobody fix this? 0.0</p>
http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?comment=45645#post-id-45645@Emmanuel Charpentier thanks for 1), my mistake. I decided to move back to linux, so my comment doesnt have sense anymore. Thanks for the feedback!Mon, 04 Mar 2019 09:13:09 -0600http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?comment=45645#post-id-45645Comment by Emmanuel Charpentier for <p>Still the same bug on SageMath version 8.2, Release Date: 2018-05-05 . Nobody fix this? 0.0</p>
http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?comment=43247#post-id-432471) This is not an answer...
2) see the mentioned [ticket](https://trac.sagemath.org/ticket/24209) (as well as [the](https://trac.sagemath.org/ticket/18036) [tickets](https://trac.sagemath.org/ticket/12715) it refers to) to understand why there is not quick-and-easy fix for this one...Fri, 03 Aug 2018 14:08:11 -0500http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?comment=43247#post-id-43247Answer by tmonteil for <p>I do not understand this :</p>
<pre><code>sage: sqrt(1) in QQbar
True
sage: sqrt(-2) in QQbar
True
sage: sqrt(-1) in QQbar
False
</code></pre>
<p>Can someone explain ?</p>
<p>Note that, however :</p>
<pre><code>sage: [t[0] in QQbar for t in (x^2+1).roots(ring=QQbar)]
[True, True]
</code></pre>
http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?answer=39511#post-id-39511This is definitely a bug, thanks for reporting! As you can see in the source code:
sage: QQbar.__contains__??
the test:
elif EQ:
which corresponds to:
sage: bool(I == QQbar(I))
leads to:
TypeError: unsupported operand parent(s) for +: 'Number Field in I with defining polynomial x^2 + 1' and 'Algebraic Field'
which is catched to return `False`.
I have opened [trac ticket 24209](https://trac.sagemath.org/ticket/24209) for this.Sun, 12 Nov 2017 18:12:08 -0600http://ask.sagemath.org/question/39509/i-doesnt-belong-to-qqbar-why/?answer=39511#post-id-39511