
com.fathzer.soft.javaluator.examples.Simplest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaluator-examples Show documentation
Show all versions of javaluator-examples Show documentation
Some examples of use of Javaluator.
package com.fathzer.soft.javaluator.examples;
import com.fathzer.soft.javaluator.DoubleEvaluator;
/** The most simple class to use the built-in real expression evaluator.*/
public class Simplest {
public static void main(String[] args) {
// Create a new evaluator
DoubleEvaluator evaluator = new DoubleEvaluator();
String expression = "(2^3-1)*sin(pi/4)/ln(pi^2)";
// Evaluate an expression
Double result = evaluator.evaluate(expression);
// Ouput the result
System.out.println(expression + " = " + result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy