edu.hws.jcm.data
Interface Function

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
SimpleFunction, FunctionParserExtension

public interface Function
extends java.io.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
 boolean dependsOn(Variable x)
          Return true if the defintion of this function depends in some way on the variable x.
 Function derivative(int wrt)
          Return the derivative of the function with repect to argument number wrt.
 Function derivative(Variable x)
          Return the derivative of the function with respect to the variable x.
 int getArity()
          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 Detail

getArity

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

getVal

public 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

public 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

public 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

public 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

public 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.)