Package com.singularsys.jep.standard
Class StandardFunctionTable
java.lang.Object
com.singularsys.jep.FunctionTable
com.singularsys.jep.standard.StandardFunctionTable
- All Implemented Interfaces:
JepComponent,Serializable
The standard function table. This is the default function table used by Jep.
Use an ! in the property value to prevent the function being added, e.g.
It includes:
- Trigonometric functions:
sin, cos, tan, asin, acos, atan, atan2, cosec, sec, cot- Hyperbolic functions:
sinh, cosh, tanh, asinh, acosh, atanh- Logarithmic and exponential functions:
log, ln, lg(log base 2),sqrt, pow,- Rounding functions:
round, rint, floor, ceil,
round(x)rounds x to the nearest integer,rint(x)rounds x to the nearest integer preferring even numbers in the case of a tie. It has a two argument versionrint(x,dp)which rounds x to a specific number of decimal places.- Complex functions:
re, im, arg, cmod, complex, polar, conj,- array and statistical functions:
avg, min, max, sum, vsum, count
These functions can take an arbitrary number of arguments and return the average, minimum, maximum, sum or count of the arguments respectively. Thevsumfunction expands any vector or matrix argument and sums the elements, so for examplevsum(1, [2,3], [[4,5],[6,7]])returns 28.- Miscellaneous functions,
abs, mod, rand, if, str, binom, signum
mod(x,y)implemented byModulusis equivalent to the java operatorx % ywith the same sign conventions.
rand()give the is implemented usingRandomreturns a random number between 0 and 1.
Theiffunctions implemented byIfcan be used with three argumentif(cond, trueval, falseval)and four argumentif(condExpr, posExpr, negExpr, zeroExpr)versions.
binom(n,k)implemented byBinomialreturns the binomial coefficient n choose k.
signum(x)implemented bySignumreturns -1, 0 or 1 depending on the sign of x.
StandardFunctionTable.arcsin=asin
StandardFunctionTable.if=!if
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.FunctionTable
table -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionReturns a new shallow copy of this function table.Methods inherited from class com.singularsys.jep.FunctionTable
addFunction, addFunctionIfSet, clear, containsKey, containsValue, copyFunctionsFrom, entrySet, getFunction, getLightWeightInstance, init, isEmpty, keySet, remove, size, threadSafeMapCopy, toString, values
-
Constructor Details
-
StandardFunctionTable
public StandardFunctionTable() -
StandardFunctionTable
-
-
Method Details
-
shallowCopy
Description copied from class:FunctionTableReturns a new shallow copy of this function table. Calls theFunctionTable.threadSafeMapCopy()method to ensure the table is safe to use a separate thread. All subclasses should override this method to create a function table of the matching type. A typical implementation would be@Override public FunctionTable shallowCopy() { Map<String,PostfixMathCommandI> newMap = this.threadSafeMapCopy(); return new myFunctionTable(newMap); }using theFunctionTable.threadSafeMapCopy()method to return a copy of the map of functions and a constructor taking this map which uses theFunctionTable(Map)constructor.- Overrides:
shallowCopyin classFunctionTable- Returns:
- a new shallow copy of this function table
-