public class DifferentiableVariable extends DifferentiableOperation
ADDITION_PRECEDENCE, POWER_PRECEDENCE, PRODUCT_PRECEDENCE, QUOTIENT_PRECEDENCE, SUBTRACTION_PRECEDENCE, SYMBOL_PRECEDENCE
Constructor and Description |
---|
DifferentiableVariable(java.lang.String name,
double defaultValue)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected DifferentiableOperation |
copySubstituting(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
Construct a copy this operation substituting the operations given in the map.
|
double |
evaluate(DifferentiableVariableValues valueMap,
java.util.Map<DifferentiableOperation,java.lang.Double> cache)
Evaluate the operation for the specified variable values using the default value if this variable is not specified in the map
|
double |
getDefaultValue()
get the default value
|
DifferentiableOperation |
getDerivative(DifferentiableVariable variable)
Get the derivative with respect to the coordinate at the specified index
|
static DifferentiableVariable |
getInstance(java.lang.String name,
double defaultValue)
generate a new variable with the specified name
|
java.lang.String |
getName()
Get the name of this variable
|
protected int |
getPrecedence()
get the operation precedence
|
protected boolean |
isEquivalentTo(DifferentiableOperation operation)
Test whether this operation is equivalent to the specified operation when the two operations are different instances.
|
void |
setDefaultValue(double value)
set the default value
|
java.lang.String |
toString()
get the string representation of this variable
|
abs, acos, asin, atan, copySubstitutingWithCache, copyWithSubstitutions, cos, cosh, evaluate, evaluate, evaluateWithCache, exp, getConstant, getVariable, isEqualTo, log, minus, minus, minus, minus, multiply, negate, over, over, over, over, plus, plus, plus, plus, plus, pow, pow, reciprocal, sin, sinh, sqrt, sum, tan, tanh, times, times, times, times, times, toString, toString
public DifferentiableVariable(java.lang.String name, double defaultValue)
name
- name of this variabledefaultValue
- value to use when none is supplied during evaluationprotected DifferentiableOperation copySubstituting(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
copySubstituting
in class DifferentiableOperation
substitutions
- map of the new operations keyed by the current operations to be substitutedpublic java.lang.String getName()
public double getDefaultValue()
public void setDefaultValue(double value)
public static DifferentiableVariable getInstance(java.lang.String name, double defaultValue)
public final double evaluate(DifferentiableVariableValues valueMap, java.util.Map<DifferentiableOperation,java.lang.Double> cache)
evaluate
in class DifferentiableOperation
public final DifferentiableOperation getDerivative(DifferentiableVariable variable)
getDerivative
in class DifferentiableOperation
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean isEquivalentTo(DifferentiableOperation operation)
isEquivalentTo
in class DifferentiableOperation
protected int getPrecedence()
getPrecedence
in class DifferentiableOperation