What implementation does sage use for solve?

Anonymous

What algorithm does sage use when you solve polynomials with the solve() function?

edit retag close merge delete

Sort by ยป oldest newest most voted

Regarding the solve function, Sage does not implement it own algorithm, instead it asks maxima to do the job by default. You can also pass the algorithm='sympy' option to use Sympy instead.

See:

sage: solve?

more

What algorithm does maxima use then? There are numerious methods to solve polynomials like Durand-Kerner...

( 2021-04-19 20:57:38 +0200 )edit

We have to check. Note however that the Durand-Kerner algorithm is numerical, while the solve function will try to give you the solutions as symbolic expressions involving nth roots:

sage: solve(2*x^2-7==0,x)
[x == -1/2*sqrt(7)*sqrt(2), x == 1/2*sqrt(7)*sqrt(2)]

( 2021-04-19 23:28:30 +0200 )edit

So is it safe to say that say that Sage solves polynomials analytically instead of numerically? Do you know how they implement such algorithm? You would think that a computer solves factorization nummerically since it can easilly calculate a lot of numbers with decent precision.

( 2021-04-20 10:36:52 +0200 )edit

So is it safe to say that say that Sage solves polynomials analytically instead of numerically?

Yep, when possible. When not possible (degree >=5, and no "obvious" paths to an explicit solution, Sage can compute root values in QQbar, which can be thought of as objects representing algorithms, computable to arbitrary precision and are treated as exact numbers by "the rest of Sage".

Do you know how they implement such algorithm?

Tou are welcome to read the source ;-) (translation : I don't know, do not know enough to know where to start...).

You would think that a computer solves factorization numerically since it can easily calculate a lot of numbers with decent precision.

That's more or less what happens when an explicit solution (first intention goal) does not exist.

( 2021-04-20 14:33:43 +0200 )edit

You could also ask on the Maxima mailing lists: https://maxima.sourceforge.io/maximal...

( 2021-04-20 18:25:24 +0200 )edit