Ask Your Question
0

What software does Sage use to solve linear equations ?

asked 2019-03-03 22:50:46 +0100

nguyenthanhvuh gravatar image

updated 2019-03-03 23:01:28 +0100

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 23:50:12 +0100

rburing gravatar image

updated 2019-03-03 23:56:18 +0100

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-04 05:23:59 +0100 )edit
1

answered 2019-03-04 00:44:55 +0100

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 22:50:46 +0100

Seen: 758 times

Last updated: Mar 04 '19