First time here? Check out the FAQ!

Ask Your Question
1

Solving equation with algebraic numbers

asked 4 years ago

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!

Preview: (hide)

Comments

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 ( 4 years ago )

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 ( 4 years ago )

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 ( 4 years ago )

thanks rburing!

creyesm1992 gravatar imagecreyesm1992 ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

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

HTH,

Preview: (hide)
link

Comments

thanks Emmanuel!

creyesm1992 gravatar imagecreyesm1992 ( 4 years ago )

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

Stats

Asked: 4 years ago

Seen: 509 times

Last updated: Aug 11 '20