[Tutor] Python and Symbolic Math for beginners

Amit Saha amitsaha.in at gmail.com
Mon Jun 17 05:18:34 CEST 2013


On Mon, Jun 17, 2013 at 1:16 PM, Jim Mooney <cybervigilante at gmail.com> wrote:
>> 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.

This is a new tutorial the SymPy guys are working on:
http://docs.sympy.org/tutorial/tutorial/index.html

I certainly found it much more coherent and it clarified a few doubts
I was having.



--
http://echorand.me


More information about the Tutor mailing list