[lang] math expression parser
hola guys, i am currently working on a math expression parser, and wanted to ask if there is interest in adding such a functionality to commons-lang? it's a simple algorithm and id be happy to contribute to this project... http://projects.congrace.de/exp4j/download.html have fun! -- *frank asseg* softwareentwicklung sebastian-kneipp-strasse 14a 79104 freiburg i. brsg. tel.: ++49-761-88790001 fax.: ++49-761-88790002 mail: frank.as...@congrace.de - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [lang] math expression parser
Hola Paul, On 05.01.2011 20:51, Paul Libbrecht wrote: I don't see why langs would have this, especially since it generally involves variables, scopes, objects, etc. Can you compare that to JEXL ? In comparison to JEXL i was looking for a possiblity to pass a simple math expression to an evaluator containing some simple functions from java.lang.Math like Math.sin(double x). An example taking user input like 2^log(2-3) and evaluating the result at runtime in a java application. I did try using the Scripting engine in Java but firing it up and evaluating expressions in this way is quite slow. With an unwarmed javascript engine it took 1sec for 800 evaluations, while the evaluation using a java implementation was done in 8ms. I thought this was of interest for commons-lang because i looked in the lang.math.* package if there was an expression evaluator there. have fun! -- *frank asseg* softwareentwicklung sebastian-kneipp-strasse 14a 79104 freiburg i. brsg. tel.: ++49-761-88790001 fax.: ++49-761-88790002 mail: frank.as...@congrace.de - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [lang] math expression parser
Hola Ted, On 05.01.2011 21:02, Ted Dunning wrote: Or bsh or jruby or rhino or groovy? sorry, i did not make myself clear but i was talking about a pure mathematical expresssion parser, intended for evaluating user input and the like, not a turing complete grammer but simply a way to evaluate thigs like log(2)^2.4 at runtime. Have fun! -- *frank asseg* softwareentwicklung sebastian-kneipp-strasse 14a 79104 freiburg i. brsg. tel.: ++49-761-88790001 fax.: ++49-761-88790002 mail: frank.as...@congrace.de - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [lang] math expression parser
Hola Paul, On 05.01.2011 21:49, Paul Libbrecht wrote: I find the classname PostfixExpression pretty bizarre... should it be simply MathExpressionParser ? heh, you got me there, the naming is pretty awkward and stems from the fact that an infix expression 2 + 2, where the operator stands between the operands is gets translated into postfix notation (2 2 +). But i can see your point and will give the naming of the classes some more thought. have fun! -- *frank asseg* softwareentwicklung sebastian-kneipp-strasse 14a 79104 freiburg i. brsg. tel.: ++49-761-88790001 fax.: ++49-761-88790002 mail: frank.as...@congrace.de - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [lang] math expression parser
Hola Gary! On 05.01.2011 22:04, Gary Gregory wrote: Why should this be in [lang] instead of [math]? I actually thought about posting on [math] but when i browsed the math library i gained the impression that it's much more concerned with more complex mathematical issues like integration of numerical analysis rather than parsing user input, so imho i decided to post to [lang], the library which i always associate with Strings ;) have fun! -- *frank asseg* softwareentwicklung sebastian-kneipp-strasse 14a 79104 freiburg i. brsg. tel.: ++49-761-88790001 fax.: ++49-761-88790002 mail: frank.as...@congrace.de - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org