Package functions.endpoint
Class Variable
Object
GeneralFunction
EndpointFunction
Variable
- All Implemented Interfaces:
Differentiable
,Evaluable
,Outputable
,Simplifiable
,Comparable<GeneralFunction>
,Iterable<GeneralFunction>
,OutputFunction
public class Variable extends EndpointFunction
-
Field Summary
Fields Modifier and Type Field Description String
varID
The String representing this variable -
Constructor Summary
-
Method Summary
Modifier and Type Method Description GeneralFunction
clone()
Returns a clone of thisGeneralFunction
int
compareSelf(GeneralFunction that)
Used internally for comparing two functions of the same exact typeboolean
equalsFunction(GeneralFunction that)
Returns true when the two fully-simplified functions are equaldouble
evaluate(Map<String,Double> variableValues)
Evaluates aGeneralFunction
at a point denoted by aMap
GeneralFunction
getDerivative(String varID)
Returns the derivative of aGeneralFunction
with respect to a variable.int
hashCode()
Returns a hash code value for this objectGeneralFunction
simplify()
Returns thisGeneralFunction
, simplifiedString
toString()
Returns a String representation of thisGeneralFunction
Methods inherited from class EndpointFunction
getName, getOperands, iterator, substituteAll, toLatex, toOutputFunction
Methods inherited from class GeneralFunction
compareTo, derivativeAt, equals, equalsSimplified, getNthDerivative, getSimplifiedDerivative, substituteVariables
-
Field Details
-
varID
public final String varIDThe String representing this variable
-
-
Constructor Details
-
Method Details
-
toString
public String toString()Description copied from class:GeneralFunction
Returns a String representation of thisGeneralFunction
- Specified by:
toString
in interfaceOutputFunction
- Specified by:
toString
in classGeneralFunction
- Returns:
- String representation of this function
-
getDerivative
Description copied from interface:Differentiable
Returns the derivative of aGeneralFunction
with respect to a variable. Should not be used in general;GeneralFunction.getSimplifiedDerivative(java.lang.String)
is strongly preferred.- Parameters:
varID
- the ID of the variable that is differentiated against- Returns:
- the derivative of the function with respect to
varID
-
evaluate
public double evaluate(Map<String,Double> variableValues)Description copied from interface:Evaluable
Evaluates aGeneralFunction
at a point denoted by aMap
- Parameters:
variableValues
- the values of the variables in theGeneralFunction
at the point- Returns:
- the value of the
GeneralFunction
at the point
-
clone
Description copied from class:GeneralFunction
Returns a clone of thisGeneralFunction
- Specified by:
clone
in classGeneralFunction
- Returns:
- a clone of this function
-
simplify
Description copied from interface:Simplifiable
Returns thisGeneralFunction
, simplified- Returns:
- the simplified function
-
equalsFunction
Description copied from class:GeneralFunction
Returns true when the two fully-simplified functions are equal- Specified by:
equalsFunction
in classGeneralFunction
- Parameters:
that
- TheGeneralFunction
that the current function is being checked against- Returns:
- true if the two functions are equal
-
compareSelf
Description copied from class:GeneralFunction
Used internally for comparing two functions of the same exact type- Specified by:
compareSelf
in classGeneralFunction
- Parameters:
that
- theGeneralFunction
that this is compared against- Returns:
- the comparison
-
hashCode
public int hashCode()Description copied from class:GeneralFunction
Returns a hash code value for this object- Specified by:
hashCode
in interfaceOutputFunction
- Specified by:
hashCode
in classGeneralFunction
- Returns:
- a hash code value for this object
-