|
|||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||
See:
Description
| Packages | |
|---|---|
| org.dyndns.kwitte.jfunction | |
jfunction is a library to evaluate function terms with one or no variable.
System.out.println(Terms.evaluate("3+4")); // prints 7
System.out.println(Terms.evaluate("2*x", 12)); // prints 24
// create a value table for the function f(x) = sin(3*x)+2
/*
* Pre-compile once to increase performance.
* This is a lot faster than calling
* Terms.evaluate("sin(3*x)+2")
* 20000 times inside the loop.
*/
Term myTerm = Terms.compile("sin(3*x)+2");
for (double d = -1000.0; d < 1000.0; d+=0.1) {
double result = myTerm.evaluate(d);
System.out.println(d + "\t" + result);
}
Terms documentation
for the precise grammar
of a valid term and for supported term features.
|
|||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||