Re: [sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-04 Thread vdelecroix
Indeed, 1e-30 is too precise. Changing to 1e-10 makes it work. The solution at https://github.com/sagemath/sage/pull/35414 is more robust. Le samedi 1 avril 2023 à 21:21:05 UTC+2, William Stein a écrit : > Thanks Vincent! What version of Sage are you using? With sage-9.8 I get: > > --- > > from

Re: [sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-04 Thread Marcel Moosbrugger
Thank you all for your help! I got the same error as William, but it pointed me into the right direction. I found a way how to get the unique bounding interval of the root in sympy and convert this interval to a sage interval. It is not the prettiest solution but the following works for me:

Re: [sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-04 Thread vdelecroix
Indeed. Sorry. One needs to take a larger error sage_approx = RIF(exp.n()) + RIF(-1e-10, 1e-10) Not the best way to proceed. The solution at https://github.com/sagemath/sage/pull/35414 should be be more robust. Le samedi 1 avril 2023 à 21:21:05 UTC+2, William Stein a écrit : > Thanks Vincent!

Re: [sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-04 Thread vdelecroix
Indeed, one has to increase the error to make it work sage_approx = RIF(exp.n()) + RIF(-1e-10, 1e-10) This is not the smartest way to proceed. Le samedi 1 avril 2023 à 21:21:05 UTC+2, William Stein a écrit : > Thanks Vincent! What version of Sage are you using? With sage-9.8 I get: > > --- > >

Re: [sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-01 Thread William Stein
Thanks Vincent!What version of Sage are you using? With sage-9.8 I get: --- from sympy import sympify exp = sympify("CRootOf(x**5 + x + 1, 0)") sage_poly = QQ['x'](list(map(QQ, reversed(exp.poly.rep.rep sage_approx = RIF(exp.n()) + RIF(-1e-30, 1e-30) QQbar.polynomial_root(sage_poly,

[sage-support] Re: How to convert complex_root_of to QQbar (algebraic number)

2023-04-01 Thread vdelecroix
Dear Marcel, It is a pity that this does not work more directly. Here is a work around to achieve what you want to do sage: exp = sympify("CRootOf(x**5 + x + 1, 0)") sage: sage_poly = QQ['x'](list(map(QQ, reversed(exp.poly.rep.rep sage: sage_approx = RIF(exp.n()) + RIF(-1e-30, 1e-30) sage: