net.sourceforge.webcompmath.data
Interface Function
- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- ExpressionFunction, FunctionParserExtension, SimpleFunction, TableFunction, WCMDerivativeBean, WCMExpressionFunctionBean, WCMExpressionInputBean, WCMTableFunctionBean, WrapperFunction
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], ... |
getArity
int getArity()
- Return the number of arguments of this function. This must be a
non-negative integer.
- Returns:
- number of args
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.
- Parameters:
arguments
- array of argument values
- Returns:
- function's value
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.
- Parameters:
arguments
- array of argument valuescases
- the cases to use
- Returns:
- function's value
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.
- Parameters:
wrt
- argument Number with respect to
- Returns:
- the derivative
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.)
- Parameters:
x
- variable with respect to
- Returns:
- the derivative
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.)
- Parameters:
x
- variable to check
- Returns:
- true or false