Click to See Complete Forum and Search --> : Identify an arbitrary function !


ngocpv
October 17th, 2006, 10:47 AM
Hi all !

I have the following problem when doing my big exercise on subject of Data Structure and Algorithm : Input an arbitrary characters string from keyboard then identify which mathematics function that characters string represents , what is its variables . Finally , plot that function on screen .

For example , for characters string : "sin(x)+2*cos(x)+3*exp(x)" , the following results must be taken :
* function : f(x)=sin(x)+2*cos(x)+3*exp(x)
* variable : x

Ploting a function is easy since it's fully identified .
I don't know which data structure (stack , queue...) is best suited for this problem and how to do it . Is there any one can help me ?

Thanks in advance !

kumaresh_ana
October 18th, 2006, 12:52 AM
What you need is Polish or Reverse Polish (http://en.wikipedia.org/wiki/Reverse_Polish_notation)notation. You will be needing stack datastructure to accomplish this.