Closed hanspi42 closed 3 years ago
Observe: https://docs.sympy.org/dev/gotchas.html#symbols
Possible solutions: restrict allowed symbols; use try/except to prevent crashes
I typically solve this by passing sympy.abc._clash to sp.sympify, i.e.:
import sympy as sp
from sympy.abc import _clash
expr = sp.sympify("1/I * N", locals = _clash)
Caveat: This removes the special meaning of the imaginary unit i
Thank you very much! We also use parse_expr()
, and I just checked that
parse_expr("1/I * N", local_dict = _clash)
also works. It is a bit annoying that sympify uses local
and parse_expr uses local_dict
, but I guess that's how it is.
Removing the special meaning of i
does not matter here.
If a branch has the weight 'N', the app crashes when trying to evaluate (e.g. Mason):
Example: eliminate node 'y' in
e01.zip