Hi Matt

You can use raw_input to get the function as string:

 >> in = raw_input()

E.g. the user would enter something like "sin(x)*log(x)". Then you can 
use the sympify function to convert this string into a sympy expression:

 >> expr = sympify(in)

Now you need to find out what symbol the user used as variable.

 >> symbols = expr.atoms(Symbol)

Hopefully just one symbol was used, but of course you will have to make 
sure. Then we want to get the derivative:
 >> s = symbols.pop()
 >> der = expr.diff(s)

For the numerical computations you might want to do the following:

 >> f = lambdify(s, der)

(For more information on lambdify read it's docstring)
Now you can compute the numerical value of the derivative easily:

 >> f(1)
2.0
 >> f(2)
2.6302769476946342

Hope this helps,
Sebastian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
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