Hello all,
In my early days of exploring SymPy, I found often that one *could*
use strings as arguments to various SymPy's functions, instead of
passing Symbol objects. A case in point is the solve() function. For
example:
>>> expr = input('Enter an expression: ')
Enter an expression: x + 3*y - 6
>>> expr = sympify(expr)
>>> solve(expr, 'y')
# get the solution back.
However, I have also learned along the way (from you all) that this is
not be relied upon. I shouldn't really use strings here. So, I
thought that (something along these lines) is the more correct
approach:
# For example:
for s in expr.atoms(Symbol):
if s.name == 'y':
solutions = solve(expr, s)
So, I think the latter is the approach I should really follow myself
and also tell others since that is the right thing to do?
Suggestions/comments are very welcome.
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/CANODV3mDRAJjK%3Dcz8vSetRJQvU90yHA3FeDNuZ1aKqenrcn_Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.