First time here? Check out the FAQ!

Ask Your Question
0

Can someone help in finding code for solve function

asked 8 years ago

Satya gravatar image

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 8 years ago

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.

Preview: (hide)
link
0

answered 8 years ago

dan_fulea gravatar image

updated 8 years ago

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
Preview: (hide)
link

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 ( 8 years ago )

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: 8 years ago

Seen: 425 times

Last updated: May 20 '17