Package com.singularsys.jep.functions
package com.singularsys.jep.functions
Classes that implement the built-in functions and operators.
There are several base classes and interfaces which can be used:
PostfixMathCommandI- The basic interface all functions should implement. Defines a
void run(Stack<Object> aStack)method. PostfixMathCommand- Base class for most functions
UnaryFunction- Base class for unary functions, just need to implement a
Object eval(Object arg)method. BinaryFunction- Base class for binary functions, just need to implement
Object eval(Object l,Object r)method. NaryBinaryFunction- Base class for n-ary functions backed by an associative operation like +,*. just need to implement
Object eval(Object l,Object r)method. CallbackEvaluationI- Interface for classes which need access to the parse-tree, for example lazy evaluation functions like && and || which do not need to evaluate all their arguments, or assignment operators which need access to a variable and not just its value.
com.singularsys.jep.reals package also define some interfaces for functions which take double arguments and
return double results, which can be quicker in special purpose evaluators.-
ClassDescriptionAbsolute value function.Addition function.The acos function.The inverse hyperbolic cos function
acosh(x).The inverse sin functionarcsin(x).Implements the arcSinH function.The arctan functionatan2(y, x) Returns the angle whose tangent is y/x.Implements the arcTanH function.Argument of a complex numberBase class for functions that operate on arrays such as Average, MinMax, and VSum.An assignment operator so we can dox=3+4.Average function class, calculates the average of all its arguments.Convenient base class for binary functions.FunctionalInterface for theBinaryFunction.instanceOf(Class, BiFunctionWithException)method.Binomial coefficients: binom(n,i).Functions which require greater control over their evaluation should implement this interface.A PostfixMathCommandI which find the smallest integer above the number ceil(pi) give 4 ceil(-i) give -3Implements the comparative operations <, >, <=, >=, !Converts a pair of real numbers to a complex number Complex(x,y)=x+i y.The complex conjugate of a number conj(c)The cosec functionThe cos functionThe hyperbolic cosine functionThe cotangent function.Count the number of elements in a list.The cross product of two 3D vectors.Division of two arguments.The dot product of two vectors.Function which allows array access using the a[3] notation on left and right-hand side.The exp function.A PostfixMathCommandI which find the largest integer above the number floor(pi) give 3 floor(-i) give -4A Unary operator which does nothing, used for unary plus +x.The if(condExpr, posExpr, negExpr) function.Represents an illegal parameterFinds the imaginary part of a complex number.A version of the logical operators which use lazy evaluation.The list function.Log base 10.Log base 2.Logical operatorsANDandOR.An interface for functions which can be used on the left-hand side of an assignment.Minimum and Maximum functions.Type of MinMax function, used to make construct clearer.Calculates the modulus x % y of the arguments.The multiplication function.Convenient base class for n-ary functions backed by a binary operation.Convenient base class for nary functions.Natural logarithm.Implementation of the not function.Convenient base class for zero-argument nullary functions, likerandom().FunctionalInterface for theBinaryFunction.instanceOf(Class, BiFunctionWithException)method.Converts an [r,theta] pair to a complex number r * e^(i theta).Abstract base classes for most function classes.Computes the power of a number.Encapsulates the Math.random() function.Finds the real part of a complex number.A PostfixMathCommandI which rounds a number to the closest integer.A PostfixMathCommandI which rounds a number.Rounding functions using BigDecimals rounding method.The secant function,sec(x)=1/cos(x).The signum function returns -1 if x<0, 1 if x>0, 0 if x==0.The sin(x) functionHyperbolic sin.Square root function.Converts an object into its string representation.A strict version of Natural logarithm.The different between two argumentsa-b.Adds it argumentssum(1,2,3,4,5)will be 15.The tan function.Hyperbolic tan.The unary minus function-x.Convenient base class for unary functions.FunctionalInterface for theBinaryFunction.instanceOf(Class, BiFunctionWithException)method.Summation function which expands the arguments.Interface for functions which can be configured to respond to zero length array arguments with either an exception, NaN or a value.Interface for classes which implementZeroLengthBehaviourIby delegating to a helper class.How to respond to a zero length array as argumentHelper class which implements the zero length behaviour.