from brian2.parsing.sympytools import str_to_sympy)
- brian2.parsing.sympytools.str_to_sympy(expr, variables=None)[source]¶
Parses a string into a sympy expression. There are two reasons for not using
sympifydirectly: 1) sympify does a
from sympy import *, adding all functions to its namespace. This leads to issues when trying to use sympy function names as variable names. For example, both
factor– quite reasonable names for variables – are sympy functions, using them as variables would lead to a parsing error. 2) We want to use a common syntax across expressions and statements, e.g. we want to allow to use
&) and function names like
expr : str
The string expression to parse.
variables : dict, optional
Dictionary mapping variable/function names in the expr to their respective
A sympy expression
In case of any problems during parsing.