javamathformulas

Java: Is there a tool available that can allow me input, store, and evaluate math formulas?


Even something very rudimentary is fine. Like entering and evaluating something like x+1, where x is a variable I get to specify.

I was thinking of writing my own using Strings for each formula, regex for parsing them, etc., but let's assume my goal is to be as lazy as I can possibly get away with, and that if there's another option (especially a formal one), I'd rather try to use that instead, first.

Is there anything out there that does something like this?


Solution

  • You can think about using scripting from Java 6. The reference JDK comes with a JavaScript implementation, and you can plug in other languages too.