[Tutor] Python and Symbolic Math for beginners
Jim Mooney
cybervigilante at gmail.com
Mon Jun 17 05:16:42 CEST 2013
> yeah, I am playing with the Python 3 version. Works great so far.
I didn't even look at the docs, but I think I got the solve part
working. I cut down on typing a bit, though. Typing Symbol all day
long could get tedious:
from sympy import Symbol as S, solve, pprint
a,b,c,x = S('a'),S('b'),S('c'),S('x')
pprint(solve(a*x*x + b*x + c, x, dict=True))
## pretty picture here
a,b,c = 3,5,6 ## seeing if it solves stuff the way I think
y = solve(a*x*x + b*x + c, x, dict=True)
print(y)
## result: [{x: -5/6 - sqrt(47)*I/6}, {x: -5/6 + sqrt(47)*I/6}]
## Oops, looks like I accidentally went complex ;')
I certainly like a module where you don't have to search and ponder,
and it works about like you expect. It seems very straightforward.
--
Jim
After indictment the bacon smuggler was put on the no-fry list
More information about the Tutor
mailing list