Yep, strings often (but won't always!) work as input. See https://github.com/sympy/sympy/wiki/Idioms-and-Antipatterns#strings-as-input .
Aaron Meurer On Tue, Jul 9, 2013 at 5:52 AM, Amit Saha <[email protected]> wrote: > Hi, > > I almost accidentally found this to work: > > >>> from sympy import solve > >>> expr='x*2 + y + 5' > >>> solve(expr,'x') > [-y/2 - 5/2] > > Upon investigation, I found this in solvers.py in the solve() function: > > def _sympified_list(w): > > return map(sympify, w if iterable(w) else [w]) > > which pretty much confirmed to me that it should be fine to use a > string as the symbol to solve for. > > But is there any reason I wouldn't want to use it? > > > Also, how is this as an entry for > > https://github.com/sympy/sympy/wiki/Quick-examples#solve-a-polynomial-equation > ? > > > Thanks, > Amit. > > > -- > http://echorand.me > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
