|
MVT API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--math.objects.Function
The Function class is a container class for the Expr class. It holds an Expr object, a VariableSet object containing the defined variables for the Expr object and the String that generated the Expr object.
Constructor Summary | |
Function(Expression expr,
VariableSet vars)
Creates an Function object given one Expr argument. |
|
Function(java.lang.String str)
Creates an Function object given one String argument. |
Method Summary | |
void |
addVariable(Variable var)
A method that adds a Variable object to a VariableSet that contains all of the defined individual Variables for the current Expression. |
Function |
differentiate(Variable var)
A method that returns a Function representation of the derivative of the current Expr differentiated with respect to String var. |
boolean |
equals(Function f)
Overrides the equal() method of the Object class. |
boolean |
equals(java.lang.String input)
Overrides the equal() method of the Object class. |
double |
evaluate()
A method used to evaluate a symbolic object given nothing. |
double |
evaluate(Variable var,
double value)
A method used to evaluate a symbolic object given a one variable name and one value |
double |
evaluate(Variable var1,
double value1,
Variable var2,
double value2)
A method used to evaulate a symbolic object given two variable names and two values |
double |
evaluate(Variable var1,
double value1,
Variable var2,
double value2,
Variable var3,
double value3)
A method used to evaulate the Expr object of this Function given three variable names and three values |
double |
evaluate(Variable var1,
double value1,
Variable var2,
double value2,
Variable var3,
double value3,
Variable var4,
double value4)
A method used to evaulate the Expr object of this Function given 4 variable names and 4 values |
double |
evaluate(VariableSet vars,
double[] values)
A method used to evaluate a symbolic object given any number of doubles contained in an array. |
Function |
evaluateOneVar(Variable var,
double value)
An method used to evaluate a Function object containing multiple variables given only one variable name and one value |
Function |
evaluateTwoVar(Variable var1,
double value1,
Variable var2,
double value2)
An method used to evaluate a Function object containing multiple variables given two variable names and two values |
Expression |
getExpression()
A method that returns an Expression object, expr, that contains the current Expression for the Function object. |
int |
getNumVariables()
Returns number of Variable objects defined in variables vector as a integer value |
Variable |
getVar(java.lang.String str)
Returns a Variable object identical to string str from the the variables VariableSet object |
VariableSet |
getVariables()
A method that returns the VariableSet that contains all of the defined individual Variables for the current Expression. |
void |
setExpression(Expression expr)
A method that initializes a Expression object, expr, that contains the current Expression for the Function object. |
void |
setVariables(VariableSet variables)
A method that initializes a VariableSet variables that contains all of the defined individual Variables for the current Expr. |
Function |
simplify()
|
java.lang.String |
toString()
Overrides the toString() method of the Object class. |
boolean |
variableDefined(Variable var)
A method that tests a Variable object against a VariableSet that contains all of the defined individual Variables to determine if there is a new instance of a Variable object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Function(java.lang.String str) throws SyntaxException
str
- the String object representing a mathematical expression
SyntaxException
- for incomplete or unparsable
mathematical expressionspublic Function(Expression expr, VariableSet vars)
expr
- the Expr object representing a mathematical expression.Method Detail |
public boolean equals(Function f)
public boolean equals(java.lang.String input)
public void setVariables(VariableSet variables)
public VariableSet getVariables()
public int getNumVariables()
public void addVariable(Variable var)
var
- the variable newly defined.public boolean variableDefined(Variable var)
var
- the new Variable object
public Variable getVar(java.lang.String str) throws VariableUndefinedException, UnacceptableVariableException
VariableUndefinedException
- for Variables not defined
UnacceptableVariableException
- for unacceptable variable
string inputspublic void setExpression(Expression expr)
expr
- the Expression to be attributed to this Function object.public Expression getExpression()
public double evaluate(VariableSet vars, double[] values) throws java.lang.ArithmeticException, VariableUndefinedException, IllegalEvaluationException
values
- an array of doubles containing the values
that correspond to the Variables contained in the
VariableSet orderedVariables
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
IllegalEvaluationException
- if the number of
variables does not equal the number of values.public double evaluate() throws java.lang.ArithmeticException, VariableUndefinedException
VariableUndefinedException
- if a variable is called in the
evaluation list but not not exist in the Function's variable list.
java.lang.ArithmeticException
- for NaN and Divide by Zeropublic double evaluate(Variable var, double value) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
var
- the name of the Variable associated with the functionvalue
- the value of the Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic double evaluate(Variable var1, double value1, Variable var2, double value2) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
var1
- the name of the first Variable associated with the
functionvalue1
- the value of the first Variablevar2
- the name of the second Variable associated with the
functionvalue2
- the value of the second Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic double evaluate(Variable var1, double value1, Variable var2, double value2, Variable var3, double value3) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
var1
- the name of the first Variable associated with the
functionvalue1
- the value of the first Variablevar2
- the name of the second Variable associated with the
functionvalue2
- the value of the second Variablevar3
- the name of the second Variable associated with the
functionvalue3
- the value of the second Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic double evaluate(Variable var1, double value1, Variable var2, double value2, Variable var3, double value3, Variable var4, double value4) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
var1
- the name of the first Variable associated with the
functionvalue1
- the value of the first Variablevar2
- the name of the second Variable associated with the
functionvalue2
- the value of the second Variablevar3
- the name of the second Variable associated with the
functionvalue3
- the value of the second Variablevar4
- the name of the second Variable associated with the
functionvalue4
- the value of the second Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic Function evaluateOneVar(Variable var, double value) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
value
- the value of the Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic Function evaluateTwoVar(Variable var1, double value1, Variable var2, double value2) throws java.lang.ArithmeticException, VariableUndefinedException, UnacceptableVariableException
value1
- the value of the Variablevalue2
- the value of the Variable
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
UnacceptableVariableException
- for unacceptable variable
string inputspublic Function differentiate(Variable var) throws VariableUndefinedException, UnacceptableVariableException
var
- the variable of differentiation
VariableUndefinedException
- for Variables not defined
UnacceptableVariableException
- for unacceptable variable
string inputspublic Function simplify()
public java.lang.String toString()
toString
in class java.lang.Object
|
MVT API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |