Misplaced Pages

Exp4j

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
The topic of this article may not meet Misplaced Pages's notability guidelines for products and services. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted.
Find sources: "Exp4j" – news · newspapers · books · scholar · JSTOR (June 2021) (Learn how and when to remove this message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Exp4j" – news · newspapers · books · scholar · JSTOR (April 2022) (Learn how and when to remove this message)
(Learn how and when to remove this message)
exp4j
Stable release0.4.3 / 2014-10-10
Repository
Written inJava
TypeMath
LicenseApache License 2.0
Websitewww.objecthunter.net/exp4j/

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 3 sin ( π ) 2 e {\displaystyle 3*{\frac {\sin {(\pi )}-2}{e}}} 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

  • mXparser - Mathematical Expressions Parser / Evaluator

References

  1. "Maven Central Repository Search". search.maven.org. Retrieved 2022-03-16.
Category: