A computer algebra system written in pure Python http://sympy.org/ . To get started to with contributing https://github.com/sympy/sympy/wiki/Introduction-to-contributing
Add
does the smart substitution but Symbol
does not
x.subs(x - 1, y)
vs. (x + 1).subs(x - 1, y)
Symbol._eval_subs
should do the same thing as Add._eval_subs
.
simplify(a_list)
and [simplify(element) for element in a_list]
. With the latter, I get the same expressions as in Mathematica, the former does not simplify at all o_O. In any case: thanks for opening the issue :-)
I'm trying to hunt down where in my code I'm using a now deprecated sympy function. I'm using pytest & python 3.7 and I'm looking at the python docs. This should work, but I can't seem to make it trigger:
$ PYTHONWARNINGS='ignore,error:::sympy' PYTHON=python3.7 PYTHONPATH=~/vc/sympy ./scripts/run_tests.sh chempy/util/pyutil.py
==== 6 passed, 1 skipped in 0.53 seconds ====
/home/bjorn/vc/sympy/sympy/matrices/matrices.py:2491: SymPyDeprecationWarning:
Dot product of non row/column vectors has been deprecated since SymPy
1.2. Use * to take matrix products instead. See
https://github.com/sympy/sympy/issues/13815 for more info.
useinstead="* to take matrix products").warn()
if I change the PYTHONWARNINGS
environment variable to simply error::DeprecationWarning
it triggers way before actually running the tests:
Traceback (most recent call last):
...
File "/opt/py37/lib/python3.7/site-packages/_pytest/assertion/rewrite.py", line 6, in <module>
import imp
File "/opt/py37/lib/python3.7/imp.py", line 33, in <module>
DeprecationWarning, stacklevel=2)
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
does anyone know the proper syntax to specifically turn SymPy warnings into errors?
PYTHONWARNINGS='ignore,error::DeprecationWarning:sympy'
and a few other combinations to no avail)
sympy.SymPyDeprecationWarning
-W"error::sympy.utilities.exceptions.SymPyDeprecationWarning"
gives Invalid -W option ignored: invalid module name: 'sympy.utilities.exceptions'
-W"error::sympy.utilities.exceptions.SymPyDeprecationWarning"
should work
factortools
module except what is suggested in the last sentence: "You can go further and extend...". Algorithms for that part may not be easily available in the literature, if at all.