Sign in to follow this  
Followers 0
Lemures

Evaluating a user's math function?

4 posts in this topic

I have to write a small program for a class, and ultimately what I need it to do is to evaluate a user's function at certain values. The functions won't be terribly complex. For example, I want an InputBox to pop up, and the user would input, say, "3(x^2)-4x+6". Then my program would evaluate it at certain values (x=0, x=1, x=2, etc) and do something with the results.

Is there an easy way to have the user input a string and have autoit convert it into a function that can be evaluated?

Share this post


Link to post
Share on other sites



Ah. I ended up using Execute(). I had forgotten that that existed. Thanks!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

http://www.codeproject.com/KB/recipes/MathieuMathParser.aspx

This may be of interest to you. It's more robust and would be better in the long run to write a parser rather than rely on AutoIt's dynamic execution functions.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0