Archive for the ‘Other’ Category

Math Parser for Java

Wednesday, September 10th, 2008

Java Programmer? Do you need to parse mathematical expressions in Java? If yes, I would like to tell you about JbcParser Mathematical Expression Parser to parse and evaluate math expressions in in your Java projects.

Parsing formulas given as strings at runtime is a challenge for any programmer when he wants to allow the user input a mathematical formula. It is easy to compute mathematical expressions that are known at compile time. We type it in our program and when we execute our program, we get the result. For example x+sin(x) can be easily computed when the value of x is supplied. However, when the mathematical expression is given as a string at runtime, for example “x+sin(x)”, it is no different then a meaningless “abc”. The programmer has to make an explicit effort to make the program understand that there is a plus (+) sign that adds the value of x and the value of sin(x). Of crourse, the program also needs to understand the concept of a function call such as “sin(x)”.
(more…)