Ask Your Question

Solving equation with algebraic numbers

asked 2020-08-10 15:23:58 +0200

creyesm1992 gravatar image

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!

edit retag flag offensive close merge delete


You 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?

rburing gravatar imagerburing ( 2020-08-10 16:08:59 +0200 )edit

Hello rburing, i tried loading solve(x^2-SR(AA(sqrt(3)))==0,x) but it gives error, what do you think?

creyesm1992 gravatar imagecreyesm1992 ( 2020-08-10 17:18:05 +0200 )edit

It 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).

rburing gravatar imagerburing ( 2020-08-10 19:12:20 +0200 )edit

thanks rburing!

creyesm1992 gravatar imagecreyesm1992 ( 2020-08-11 23:09:25 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-08-11 09:25:14 +0200

Emmanuel Charpentier gravatar image

A 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()


edit flag offensive delete link more


thanks Emmanuel!

creyesm1992 gravatar imagecreyesm1992 ( 2020-08-11 23:09:10 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-08-10 15:23:58 +0200

Seen: 161 times

Last updated: Aug 11 '20