Ask Your Question
0

What software does Sage use to solve linear equations ?

asked 2019-03-03 15:50:46 -0500

nguyenthanhvuh gravatar image

updated 2019-03-03 16:01:28 -0500

Hi, I have been using Sage in my project mainly to solve a large list of large (hundred of unknowns) linear equations, i.e., solve(eqts, variable). However, Sage is so large that it becomes inconvenient to ask users to download Sage to use my work. I've tried to use sympybut its equation solver is much slower compare to the one in Sage. So I am wondering what software that Sage uses underneath for linear equation solving ? It's probably one of those listed here http://www.sagemath.org/links-compone... but I don't know which.

Note that I want a solver that can give symbolic solution, e.g., instead of solutions such as x = 3, y =6, it would say x = v1, y = 2*v1. This is how I use solve in Sage.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2019-03-03 16:50:12 -0500

rburing gravatar image

updated 2019-03-03 16:56:18 -0500

From the documentation of solve:

algorithm - string (default: ‘maxima’);

Sage uses Maxima by default.

Also, more precisely, the source code of solve includes:

if len(s) == 0: # if Maxima's solve gave no solutions, try its to_poly_solve
    try:
        s = m.to_poly_solve(variables)
    except Exception: # if that gives an error, stick with no solutions
        s = []

if len(s) == 0: # if to_poly_solve gave no solutions, try use_grobner
    try:
        s = m.to_poly_solve(variables,'use_grobner=true')
    except Exception: # if that gives an error, stick with no solutions
        s = []

So try Maxima's solve and to_poly_solve, and try the latter with use_grobner=true.

edit flag offensive delete link more

Comments

Thanks, I'll look at Maxima

nguyenthanhvuh gravatar imagenguyenthanhvuh ( 2019-03-03 22:23:59 -0500 )edit
1

answered 2019-03-03 17:44:55 -0500

nbruin gravatar image

If you know you want to solve linear equations you shouldn't use solve. It probably works, but that machinery is used for more complicated types of equations. You should write your system in terms of matrices and vectors and use the specializaed solving routines for that. It depends on the nature of the coefficients which software it uses.

edit flag offensive delete link more

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: 2019-03-03 15:50:46 -0500

Seen: 53 times

Last updated: Mar 03