Ask Your Question
0

Can someone help in finding code for solve function

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

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
0

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

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
0

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

dan_fulea gravatar image

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

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

sage: solve.__module__
'sage.symbolic.relation'
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__
'/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc'

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/relation.py
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...

$SAGE_ROOT/local/lib/python2.7/site-packages/sage/symbolic/relation.py
edit flag offensive delete link more

Comments

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/relation.py. other related commands are search_def and search_src.

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

Stats

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

Seen: 393 times

Last updated: May 20 '17