|
MVT API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--math.objects.Expression | +--math.objects.Variable
The class Variable is used to create mathematical Variable objects. It extends the Expr class.
Constructor Summary | |
Variable(java.lang.String identity)
Creates an Variable object given one String argument. |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Overrides the compareTo method of the Comparable object This is used for the VariableSet. |
Expression |
differentiate(Variable var)
A method that returns the derivative of the Variable object using the summation rule of differentiation |
boolean |
equals(Variable var)
Overrides the equal() method of the Object class. |
double |
evaluate(VariableSet vars,
double[] values)
A method used to evaluate a Variable object given an ordered variable vector and a corresponding array of constant double values |
Expression |
evaluateVariables(VariableSet variables,
double[] values)
A method used to evaluate a Variable object containing multiple variables given only one variable name and one value |
java.lang.String |
getIdentity()
Returns the Variable object's identity as a String object |
void |
setIdentity(java.lang.String ident)
Alternate method to set the Variable object's identity to a String object |
Expression |
simplify()
A method that returns a Expression representation of the Variable object with its onlyChild in a simplified form with redundant terms combined and terms multiplied by zero eliminated. |
java.lang.String |
toString()
Overrides the toString() method of the Object class. |
Methods inherited from class math.objects.Expression |
evaluate, evaluate, evaluate, evaluate, evaluate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Variable(java.lang.String identity) throws UnacceptableVariableException
UnacceptableVariableException
- if variable is of
an unacceptable form.Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getIdentity()
public void setIdentity(java.lang.String ident)
public boolean equals(Variable var)
public double evaluate(VariableSet vars, double[] values) throws java.lang.ArithmeticException, IllegalEvaluationException, VariableUndefinedException
evaluate
in class Expression
vars
- the name of the VariableVector of Variables
associated with the function.
VariableUndefinedException
- for Variables not defined
java.lang.ArithmeticException
- for NaN and Divide by Zero
IllegalEvaluationException
- if an error occurspublic Expression evaluateVariables(VariableSet variables, double[] values) throws java.lang.ArithmeticException, IllegalEvaluationException
evaluateVariables
in class Expression
variables
- a VariableSet
valuevalues
- a double[]
value
IllegalEvaluationException
- if the number of variables
do not equal the number of values.
java.lang.ArithmeticException
- for NaN and Divide by Zeropublic Expression differentiate(Variable var)
differentiate
in class Expression
var
- the variable of differentiation
public Expression simplify()
simplify
in class Expression
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
|
MVT API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |