[EMAIL PROTECTED] wrote:

Quoting Ismael Garrido <[EMAIL PROTECTED]>:



I am trying to make a program that will plot functions. For that, I need
to be able to get an input (the function to be plotted) and execute it.

>
>
>So you want the user to be able to type something like "f(x) = sin(2*x)" and
>then your program will plot it --- is that correct?


Yes, that's what I want.


>Maybe you could parse it yourself? I have found SimpleParse quite easy to use
>--- http://simpleparse.sourceforge.net/ . You will need to write your own
>grammar to describe functions


(Newbie looking scared) That's kind of hard for me... Parsing it myself is too complex for me. Also, I hoped Python's math would do the job for me, so I wouldn't have to make what's already done in Python.

For what I understood of Mr. Clarke's mail, eval() would do the job (in spite of the security problem, I'm not concerned about that). Is that correct? I guess I'll go read about that a bit more.

Thanks for your replies.
Ismael
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to