Interface Function

All Superinterfaces:
Serializable
All Known Implementing Classes:
ExpressionFunction, FunctionParserExtension, SimpleFunction, TableFunction, WrapperFunction

public interface Function extends Serializable
A Function is a mathematical real-valued function of zero or more real-valued arguments. The number of arguments is called the arity of the function.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return true if the defintion of this function depends in some way on the variable x.
    derivative(int wrt)
    Return the derivative of the function with repect to argument number wrt.
    Return the derivative of the function with respect to the variable x.
    int
    Return the number of arguments of this function.
    double
    getVal(double[] arguments)
    Find the value of the function at the argument values given by arguments[0], arguments[1], ...
    double
    getValueWithCases(double[] arguments, Cases cases)
    Find the value of the function at the argument values given by arguments[0], arguments[1], ...
  • Method Details

    • getArity

      int getArity()
      Return the number of arguments of this function. This must be a non-negative integer.
    • getVal

      double getVal(double[] arguments)
      Find the value of the function at the argument values given by arguments[0], arguments[1], ... The length of the array, arguments, should be equal to the arity of the function.
    • getValueWithCases

      double getValueWithCases(double[] arguments, Cases cases)
      Find the value of the function at the argument values given by arguments[0], arguments[1], ... The length of the array argument should be equal to the arity of the function. Information about "cases" is stored in the Cases parameter, if it is non-null. See the Cases class for more information.
    • derivative

      Function derivative(int wrt)
      Return the derivative of the function with repect to argument number wrt. For example, derivative(1) returns the derivative function with respedt to the first argument. Note that argements are numbered starting from 1.
    • derivative

      Function derivative(Variable x)
      Return the derivative of the function with respect to the variable x. This will be non-zero only if x occurs somehow in the definition of x: For example, f(y) = sin(x*y); (This routine is required for the general function-differentiating code in the class FunctionParserExtension.)
    • dependsOn

      boolean dependsOn(Variable x)
      Return true if the defintion of this function depends in some way on the variable x. If not, it's assumed that the derivative w.r.t. x of the function, applied to any arguments that do not themselves depend on x, is zero. (This routine is required for the general function-differentiating code in the class FunctionParserExtension.)