# 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.

The `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.

- Related Packages
  Package
  Description
  com.singularsys.jep
  The main package containing the Jep class as well as other core classes.
  com.singularsys.jep.functions.strings
  String functions.
- Class
  Description
  Abs
  Absolute value function.
  Add
  Addition function.
  ArcCosine
  The acos function.
  ArcCosineH
  The inverse hyperbolic cos function `acosh(x)`.
  ArcSine
  The inverse sin function `arcsin(x)`.
  ArcSineH
  Implements the arcSinH function.
  ArcTangent
  The arctan function
  ArcTangent2
  atan2(y, x) Returns the angle whose tangent is y/x.
  ArcTanH
  Implements the arcTanH function.
  Arg
  Argument of a complex number
  ArrayFunctionBase
  Base class for functions that operate on arrays such as Average, MinMax, and VSum.
  Assign
  An assignment operator so we can do `x=3+4`.
  Average
  Average function class, calculates the average of all its arguments.
  BinaryFunction
  Convenient base class for binary functions.
  BinaryFunction.BiFunctionWithException<T>
  FunctionalInterface for the `BinaryFunction.instanceOf(Class, BiFunctionWithException)` method.
  Binomial
  Binomial coefficients: binom(n,i).
  CallbackEvaluationI
  Functions which require greater control over their evaluation should implement this interface.
  Ceil
  A PostfixMathCommandI which find the smallest integer above the number ceil(pi) give 4 ceil(-i) give -3
  Comparative
  Implements the comparative operations <, >, <=, >=, !
  ComplexPFMC
  Converts a pair of real numbers to a complex number Complex(x,y)=x+i y.
  Conjugate
  The complex conjugate of a number conj(c)
  Cosecant
  The cosec function
  Cosine
  The cos function
  CosineH
  The hyperbolic cosine function
  Cotangent
  The cotangent function.
  Count
  Count the number of elements in a list.
  Cross
  The cross product of two 3D vectors.
  Divide
  Division of two arguments.
  Dot
  The dot product of two vectors.
  Ele
  Function which allows array access using the a[3] notation on left and right-hand side.
  Exp
  The exp function.
  Floor
  A PostfixMathCommandI which find the largest integer above the number floor(pi) give 3 floor(-i) give -4
  Identity
  A Unary operator which does nothing, used for unary plus +x.
  If
  The if(condExpr, posExpr, negExpr) function.
  IllegalParameterException
  Represents an illegal parameter
  Imaginary
  Finds the imaginary part of a complex number.
  LazyLogical
  A version of the logical operators which use lazy evaluation.
  List
  The list function.
  Logarithm
  Log base 10.
  LogBase2
  Log base 2.
  Logical
  Logical operators `AND` and `OR`.
  LValueI
  An interface for functions which can be used on the left-hand side of an assignment.
  MinMax
  Minimum and Maximum functions.
  MinMax.MinMaxType
  Type of MinMax function, used to make construct clearer.
  Modulus
  Calculates the modulus x % y of the arguments.
  Multiply
  The multiplication function.
  NaryBinaryFunction
  Convenient base class for n-ary functions backed by a binary operation.
  NaryFunction
  Convenient base class for nary functions.
  NaturalLogarithm
  Natural logarithm.
  Not
  Implementation of the not function.
  NullaryFunction
  Convenient base class for zero-argument nullary functions, like `random()`.
  NullaryFunction.SupplierWithException<T>
  FunctionalInterface for the `BinaryFunction.instanceOf(Class, BiFunctionWithException)` method.
  Polar
  Converts an [r,theta] pair to a complex number r * e^(i theta).
  PostfixMathCommand
  Abstract base classes for most function classes.
  Power
  Computes the power of a number.
  Random
  Encapsulates the Math.random() function.
  Real
  Finds the real part of a complex number.
  RInt
  A PostfixMathCommandI which rounds a number to the closest integer.
  Round
  A PostfixMathCommandI which rounds a number.
  RoundBD
  Rounding functions using BigDecimals rounding method.
  Secant
  The secant function, `sec(x)=1/cos(x)`.
  Signum
  The signum function returns -1 if x<0, 1 if x>0, 0 if x==0.
  Sine
  The sin(x) function
  SineH
  Hyperbolic sin.
  SquareRoot
  Square root function.
  Str
  Converts an object into its string representation.
  StrictNaturalLogarithm
  A strict version of Natural logarithm.
  Subtract
  The different between two arguments `a-b`.
  Sum
  Adds it arguments `sum(1,2,3,4,5)` will be 15.
  Tangent
  The tan function.
  TanH
  Hyperbolic tan.
  UMinus
  The unary minus function `-x`.
  UnaryFunction
  Convenient base class for unary functions.
  UnaryFunction.FunctionWithException<T>
  FunctionalInterface for the `BinaryFunction.instanceOf(Class, BiFunctionWithException)` method.
  VSum
  Summation function which expands the arguments.
  ZeroLengthBehaviourI
  Interface for functions which can be configured to respond to zero length array arguments with either an exception, NaN or a value.
  ZeroLengthBehaviourI.DefaultZeroLengthBehaviourI
  Interface for classes which implement `ZeroLengthBehaviourI` by delegating to a helper class.
  ZeroLengthBehaviourI.ZeroLengthErrorBehaviour
  How to respond to a zero length array as argument
  ZeroLengthBehaviourI.ZeroLengthHelper
  Helper class which implements the zero length behaviour.