Bill Bell wrote:
> Hello all,
>
> I am teaching an adult who is struggling (and I mean struggling) to
> learn how to expand and simplify algebraic expressions. I have been
> using sympy to produce solutions for randomly produced examples using
> '.expand.' But there has to be a better way of getting expressions
> 'in' to sympy.
>
> I have been writing things like
>
> (5*(3*x-10)-4*(6-2*x)). expand()
>
> How can I pass a string such as '5*(3*x-10)-4*(6-2*x)' to /expand/ for
> processing, please?
>
> Bill
>
> --
> Bill Bell, C.D.P.
> Blog: http://unsymptomatictoo.blogspot.com/
> LinkedIn profile - http://www.linkedin.com/in/williambell
> >
>
>   
Sorry I left out the last line in the previous email -

#!/usr/bin/python

from sympy import *

import sys,string,os

def new_symbol(sym):
    name = sym
    setattr(sys.modules[__name__],name,Symbol(name))
    return

for name in string.lowercase:
    new_symbol(name)

while 1:
    symstr = sys.stdin.readline()
    A = eval(symstr)
    print A.expand()



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to