A Java equation parser
Last update: 21:28 GMT 18-12-2012
- Addition [a+b]
- Subtraction [a-b]
- Multiplication [a*b]
- Division [a/b]
- Exponentiation [a^b]
- Negation [-a]
- Trigonometric functions [sin(a), cos(a), tan(a)]
- Factorial [a!]
- Square/cube root functions [sqrt(a), cbrt(a)]
- Constants [pi, e]
- Custom variables(see usage example in the class documentation)
- Custom functions (see usage example in the class documentation)
- All trig functions use degrees, however if you want to use radians simply append an 'r'; e.g. sinr(a), cosr(a)...
- Only integer factorials are supported. If you attempt to use a decimal value, its floor will be used; i.e. 2.5! will equal 2!
- Multiple division is parsed such that "a/b/c" == "(a/b)/c"
- Multiple subtraction is parsed such that "a-b-c" == "(a-b)-c"
- Functions (custom and regular), custom variables and constants are all case-insensitive, i.e. "sin(a)" == "Sin(a)" == "SIN(a)"
Source code on GitHub