Ask Your Question

Can someone help in finding code for solve function

asked 2017-05-20 09:28:34 +0200

Satya gravatar image

Can someone help in finding code for solve function, i went through the source code but couldn't find it.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-05-20 16:12:02 +0200

tmonteil gravatar image

You can access the source code of the solve function by typing, from a Sage shell:

sage: solve??

And then see which other function is called depending on the kind of input. Then you can iterate on what is actually called in your concrete example.

edit flag offensive delete link more

answered 2017-05-20 15:48:06 +0200

dan_fulea gravatar image

updated 2017-05-20 15:49:02 +0200

This is a linux machine, while running sage from in the terminal i was asking for...

sage: solve.__module__
sage: t = sage.symbolic.relation
sage: t
<module 'sage.symbolic.relation' from '/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc'>
sage: t.__file__

And indeed, in the py-module for the above pyc-source one can find a line with def solve:

dan@k7:~$ fgrep "def solve" /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/
def solve(f, *args, **kwds):
def solve_mod(eqns, modulus, solution_dict = False):
def solve_ineq_univar(ineq):
def solve_ineq_fourier(ineq,vars=None):
def solve_ineq(ineq, vars=None):

Similar steps should work on any other machine. For instance, after calling sage -sh (on linux) the location may be...

edit flag offensive delete link more


with import_statements(solve), you'll get from sage.symbolic.relation import solve, and this corresponds in the sage source tree to the file src/sage/symbolic/ other related commands are search_def and search_src.

mforets gravatar imagemforets ( 2017-05-20 19:44:08 +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


Asked: 2017-05-20 09:28:34 +0200

Seen: 291 times

Last updated: May 20 '17