Link to home
Start Free TrialLog in
Avatar of hafhalf
hafhalf

asked on

reading an equation from an edit box?

How can i make the program itself understand an equation that i write into an edit box ,  for example , i would write 4x^3 + 2x^2 -x +2 ,
the computer would just see it as the string ' 4x^3 + 2x^2 -x +2' , but i want it to be able to read it 4*(x*x*x)+2*(x*x)-(x)+2 where the x would be a declered variable in the program , is there a way to do this without 1000 if loops or should i just build the program with dozenz if listboxes to make my life more easier , but the program less user friendly.
When and if i´m able to do this , i´m going to make the computer draw graphs in a given domain , and hopefully also calculate the area between two graphs , but it kinda all lies on that damn edit compenent , can someone out there please help me , this is for my final project in a programming course, and i am getting really tired of this .......
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rwilson032697
rwilson032697

Also look at these ones from the same location:

parsers1.zip: "TFunctionParser and TComplexParser parse mathematical functions and evaluate them. About 80 real and 30 complex predefined functions and operations available! Constants, functions and variables can be defined by the user! "

parser10.zip: "TParser - parsing and evaluating mathematical expressions specified at runtime. Only about 40% slower than the equivalent compiled expression"

exprev10.zip: "A mathematical function parser that allows you to calculate a value given an expression in string form. Supports: +, -, *, /, ^, (, ), ABS, ATAN, COS, EXP, LN, ROUND, SIN, SQRT, SQR, TRUNC, and unlimited number of user-defined variables"

Cheers,

Raymond.



Avatar of hafhalf

ASKER

Thanx Raymond ,

but there is a little problem , although i don´t doubt that these components work , the url for xaeval.zip  is invalid , and the search engine on the delphi super page is bogus , and when i search for parser1.zip it give me everything except that file , so if you could tell me were i could get these files elsewhere i would be very greatful....

                                                                            Hafsteinn.
I'm sorry you have had problems. Give me your email address and I will download and email them to you - can't say fairer than that :-)

Cheers,

Raymond.
Avatar of hafhalf

ASKER

thanx
Raymond

my e-mail is hafhalf@fas.is

Hafsteinn.
I have sent them to youe email address above.

Cheers,

Raymond.