ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 11 Aug 2020 23:09:25 +0200Solving equation with algebraic numbershttps://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/ Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!Mon, 10 Aug 2020 15:23:58 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/Comment by rburing for <p>Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52928#post-id-52928You can convert algebraic numbers to symbolic expressions using `SR(...)`. Probably you would rather want to define an ideal in a polynomial ring, and compute a GrÃ¶bner basis and/or the associated `variety` (if the system has finitely many solutions). Can you add the system you actually want to solve?Mon, 10 Aug 2020 16:08:59 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52928#post-id-52928Comment by creyesm1992 for <p>Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52932#post-id-52932Hello rburing, i tried loading solve(x^2-SR(AA(sqrt(3)))==0,x) but it gives error, what do you think?Mon, 10 Aug 2020 17:18:05 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52932#post-id-52932Comment by rburing for <p>Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52935#post-id-52935It seems Maxima can't handle the symbolic wrapper around `AA` elements. Try `SR(AA(sqrt(3))).numerical_approx()` for numerics, or `AA(sqrt(3)).radical_expression()` for an exact expression. Not all algebraics are expressible in terms of radicals, so this is not a good approach in general. Also `solve` may return only approximate solutions in more complicated cases. I would instead create an ideal `I` in a polynomial ring and call `I.variety(AA)` or `I.variety(QQbar)`.Mon, 10 Aug 2020 19:12:20 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52935#post-id-52935Comment by creyesm1992 for <p>Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52950#post-id-52950thanks rburing!Tue, 11 Aug 2020 23:09:25 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52950#post-id-52950Answer by Emmanuel Charpentier for <p>Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?answer=52942#post-id-52942A possible one-liner :
sage: (AA["x"](x^2-AA(sqrt(3)))).roots()
which can be abrbreviated as
sage: (x^2-AA(sqrt(3))).polynomial(AA).roots()
HTH,Tue, 11 Aug 2020 09:25:14 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?answer=52942#post-id-52942Comment by creyesm1992 for <p>A possible one-liner :</p>
<pre><code>sage: (AA["x"](x^2-AA(sqrt(3)))).roots()
</code></pre>
<p>which can be abrbreviated as </p>
<pre><code>sage: (x^2-AA(sqrt(3))).polynomial(AA).roots()
</code></pre>
<p>HTH,</p>
https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52949#post-id-52949thanks Emmanuel!Tue, 11 Aug 2020 23:09:10 +0200https://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/?comment=52949#post-id-52949