I have a problem with calculating eigenvectors for a simple 3x3 matrix in sympy. Trying to execute
q = symbols("q", positive=True) m = Matrix([[-2, exp(-q), 1], [exp(q), -2, 1], [1, 1, -2]]) #m.eigenvects(simplify=True) m.eigenvals()
results in very complicated expressions for the eigenvalues, trying to get the eigenvectors fails with a NotImplementedError. I expect the latter to be due to the former. However, when trying to do the same thing in Mathematica, I get much simpler expressions for everything. Is there some option / flag that I can set to have sympy compute these eigenvalues and eigenvectors? Is there currently some form of limitation within sympy that prevents me from doing this?
simplifyflag, but it doesn't work
Adddoes the smart substitution but
x.subs(x - 1, y)vs.
(x + 1).subs(x - 1, y)
Symbol._eval_subsshould do the same thing as
[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)