# Can someone help in finding code for solve function

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

Can someone help in finding code for solve function

add a comment

0

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.

0

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
```

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`

.

Please start posting anonymously - your entry will be published after you log in or create a new account.

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

Seen: **218 times**

Last updated: **May 20 '17**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.