public class UserDefinedFunction extends Function
UserDefinedFunction
object represents a mathematical function
with a name, one or more parameters and a definition (e.g.:
f(x,y)=x+y
).Modifier and Type | Field and Description |
---|---|
protected Expression |
definition
The function's definition.
|
Constructor and Description |
---|
UserDefinedFunction(String name,
String[] param)
Creates a new
UserDefinedFunction with the specified
name and parameters . |
UserDefinedFunction(String name,
String[] param,
Expression def)
Creates a new
UserDefinedFunction with the specified
name , parameters and definition . |
Modifier and Type | Method and Description |
---|---|
Evaluator |
getCallEvaluator(Type defaultType,
Context context)
Returns the
Evaluator for this
UserDefinedFunction by calling
the method Expression.getEvaluator(Type,Context) on the
definition field. |
Expression |
getDefinition()
Returns the Expression representing the function's definition.
|
Function |
getDerivative(int paramIndex)
Returns the derivative function of this UserDefinedFunction with
respect to the paramIndex' parameter.
|
Expression |
insertArguments(Expression param)
Returns a dissolved FunctionCall of this Function with the specified
parameters.
|
void |
setDefinition(Expression newDef)
Sets the definition of this
UserDefinedFunction to the
specified Expression . |
String |
toString()
Returns the
String representing this
UserDefinedFunction . |
getName, getParameter, getParameterCount, getParameterIndex, getParameters, setParameters
protected Expression definition
public UserDefinedFunction(String name, String[] param)
UserDefinedFunction
with the specified
name
and parameters
. The definition
Expression
remaines null
.name
- the function's name.param
- an array of the function's parameters.setDefinition(Expression)
public UserDefinedFunction(String name, String[] param, Expression def)
UserDefinedFunction
with the specified
name
, parameters
and definition
.name
- the function's name.param
- an array of the function's parameters.def
- the definition of this UserDefinedFunction
.public Evaluator getCallEvaluator(Type defaultType, Context context)
Evaluator
for this
UserDefinedFunction
by calling
the method Expression.getEvaluator(Type,Context)
on the
definition
field. Usually the specified Context
will be the FunctionCallEvaluator
for the FunctionCall
"calling" this UserDefinedFunction
.getCallEvaluator
in class Function
defaultType
- the Type
, Symbols
will be
evaluated to.context
- the FunctionCallEvaluator
for this
UserDefinedFunction
.Evaluator
for the function's definition.FunctionCallEvaluator.getEvaluator(Symbol)
,
getDefinition()
public Expression getDefinition()
public Function getDerivative(int paramIndex)
getDerivative
in class Function
Expression.differentiate(Symbol)
public Expression insertArguments(Expression param)
insertArguments
in class Function
public void setDefinition(Expression newDef)
UserDefinedFunction
to the
specified Expression
.newDef
- the new definition.