Exp4j Explained

exp4j
Programming Language:Java
Latest Release Version:0.4.3
Latest Release Date:2014-10-10
License:Apache License 2.0
Genre:Math

exp4j is a small Java library for evaluation of mathematical expressions.[1] 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

License terms

exp4j is released under the terms of the Apache License 2.0

Examples of usage

Calculating the result of

3*

\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

Notes and References

  1. Web site: Maven Central Repository Search . 2022-03-16 . search.maven.org.