Exp4j
Stable release |
0.4.3
/ 2014-10-10 |
---|---|
Written in | Java |
Type | Math |
License | Apache License 2.0 |
Website |
www |
exp4j is a small Java library for evaluation of mathematical expressions. It implements Dijkstra's Shunting-yard algorithm to translate expressions from infix notation to Reverse Polish notation and calculates the result using a simple Stack algorithm.
Features
- Variables can be used in expressions
- exp4j comes with a set of common built-in functions
- Users can create and use their own custom operators
- Users can create and use their own custom functions
License terms
exp4j is released under the terms of the Apache License 2.0
Examples of usage
Calculating the result of can be done in the following way:
Expression e = new ExpressionBuilder("3 * (sin(pi) - 2 )/ e")
.variables("pi", "e")
.build()
.setVariable("pi", Math.PI)
.setVariable("e", Math.E);
double result = e.evaluate();
See also
- Shunting-yard algorithm – Explanation of the Shunting-yard algorithm by Edsger Dijkstra
- Reverse Polish notation - Allows Stack based algorithms to evaluate expressions
- Apache License 2.0 - Version 2 of the Apache Software License
- mXparser - Mathematical Expressions Parser / Evaluator
References
This article is issued from Wikipedia - version of the 2/23/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.