I am running a code that takes different inputs (generated by another code) as strings and I need to turn them into sympy expressions. I use from sympy.parsing.sympy_parser import parse_expr
and it works well, however sometimes I get really big numbers (which are wrong expressions), but i can't check beforehand, as they come as strings and when I run parse_expr on them it takes forever. One such example is below:
from sympy.parsing.sympy_parser import parse_expr
eq = "tan(sin(7.10414690881377e-30370322717341*x0) - 9183346819072.0)"
parse_expr(eq)
Again, in the actual code I don't know eq
before hand. Is there an easy way to avoid this. For example to set a time limit on parse_expr? Or to set a limit on the maximum value allowed for a parameter in eq
?