It is not recommended to pass strings to SymPy functions like this.
Support for this will eventually be removed. If you want to convert a
string to a SymPy expression, it's better to pass it to sympify()
(note the different spelling from simplify()) first, like
expr = sympify('x*sin(x)**2+x*cos(x)**2')
expand(expr)
This will raise SympifyError if there is a syntax error, as you noted.
You can also use parse_expr() if you want more low-level control over
how strings are parsed.
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sympy+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/5979f86f-f838-407a-8e85-174a987935e7n%40googlegroups.com.