[Tutor] Python and Symbolic Math for beginners

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Jun 17 16:07:42 CEST 2013


On 17 June 2013 04:16, 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')

Use the symbols convenience function. e.g. (in isympy):

In [1]: from sympy import symbols

In [2]: a, b, c, x = symbols('a b c x')

In [3]: a
Out[3]: a

In [4]: Force, Mass, Acceleration = symbols('Force Mass Acceleration')

In [5]: Force
Out[5]: Force

In [6]: alpha, beta, gammas = symbols('alpha beta gamma')

In [7]: alpha
Out[7]: alpha

On Linux that last line would show the actual Greek letter α but this
is Windows and sympy knows that I'm using a rubbish console.


Oscar


More information about the Tutor mailing list