Package functions.unitary.transforms
Class Differential
Object
GeneralFunction
UnitaryFunction
Transformation
Differential
- All Implemented Interfaces:
Differentiable
,Evaluable
,Outputable
,Simplifiable
,Comparable<GeneralFunction>
,Iterable<GeneralFunction>
public class Differential extends Transformation
The
Differential
class is used as an intermediary for operations related to parsing derivatives and integrals.
Operations such as execute()
and Evaluable.evaluate(Map)
are NOT SUPPORTED, as all instances of this class should be converted to other transforms before evaluation.
If evaluation or execution of this class is ever attempted by the CAS, please raise an issue on the GitHub repository.-
Field Summary
-
Constructor Summary
Constructors Constructor Description Differential(Variable operand)
Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives, using aVariable
Differential(GeneralFunction variable)
Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives, assuming that the operand is a variableVariable
Differential(String respectTo)
Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives -
Method Summary
Modifier and Type Method Description UnitaryFunction
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)
Differentiation is not supported by this class, as it is purely an intermediaryGeneralFunction
execute()
Execution is not supported by this class, as it is purely an intermediaryGeneralFunction
getDerivative(String varID)
Evaluation is not supported by this class, as it is purely an intermediaryUnitaryFunction
getInstance(GeneralFunction function)
Returns a new instance of thisUnitaryFunction
UnitaryFunction
simplify()
Returns thisGeneralFunction
, simplifiedUnitaryFunction
simplifyInternal()
Simplifies theUnitaryFunction.operand
usingSimplifiable.simplify()
GeneralFunction
substituteVariables(Map<String,? extends GeneralFunction> toSubstitute)
Substitutes variables with functions as specified in a mapOutputFunction
toOutputFunction()
Converts this function into anOutputFunction
for use in string conversionString
toString()
Returns a String representation of thisGeneralFunction
Methods inherited from class UnitaryFunction
hashCode, iterator, newInstanceOf, simplifyFOC, simplifyInverse, substituteAll
Methods inherited from class GeneralFunction
compareTo, derivativeAt, equals, equalsSimplified, getNthDerivative, getSimplifiedDerivative
-
Constructor Details
-
Differential
public Differential(String respectTo)Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives- Parameters:
respectTo
- the variable that the differential is with respect to
-
Differential
Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives, using aVariable
- Parameters:
operand
- the variable that the differential is with respect to
-
Differential
Constructs a newDifferential
, which is sometimes used as an intermediary for integrals and derivatives, assuming that the operand is a variableVariable
- Parameters:
variable
- the variable that the differential is with respect to- Throws:
ClassCastException
- if the operand is not an instance ofVariable
-
-
Method Details
-
toString
public String toString()Description copied from class:GeneralFunction
Returns a String representation of thisGeneralFunction
- Overrides:
toString
in classUnitaryFunction
- Returns:
- String representation of this function
-
clone
Description copied from class:GeneralFunction
Returns a clone of thisGeneralFunction
- Overrides:
clone
in classUnitaryFunction
- Returns:
- a clone of this function
-
substituteVariables
Description copied from class:GeneralFunction
Substitutes variables with functions as specified in a map- Overrides:
substituteVariables
in classGeneralFunction
- Parameters:
toSubstitute
- the map betweenVariable
strings andGeneralFunction
s- Returns:
- the new
GeneralFunction
after all substitutions are preformed
-
equalsFunction
Description copied from class:GeneralFunction
Returns true when the two fully-simplified functions are equal- Overrides:
equalsFunction
in classUnitaryFunction
- 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- Overrides:
compareSelf
in classUnitaryFunction
- Parameters:
that
- theGeneralFunction
that this is compared against- Returns:
- the comparison
-
getDerivative
Evaluation is not supported by this class, as it is purely an intermediary- Parameters:
varID
- The variable that the function's derivative is taken with respect to- Returns:
- nothing, because this method will always throw an error
- Throws:
DerivativeDoesNotExistException
- whenever this method is called
-
evaluate
public double evaluate(Map<String,Double> variableValues)Differentiation is not supported by this class, as it is purely an intermediary- Parameters:
variableValues
- The values of each variable- Returns:
- nothing, because this method will always throw an error
- Throws:
UnsupportedOperationException
- whenever this method is called
-
simplify
Description copied from interface:Simplifiable
Returns thisGeneralFunction
, simplified- Specified by:
simplify
in interfaceSimplifiable
- Overrides:
simplify
in classTransformation
- Returns:
- the simplified function
-
simplifyInternal
Description copied from class:UnitaryFunction
Simplifies theUnitaryFunction.operand
usingSimplifiable.simplify()
- Overrides:
simplifyInternal
in classUnitaryFunction
- Returns:
- an instance of this
UnitaryFunction
with theUnitaryFunction.operand
simplified
-
getInstance
Description copied from class:UnitaryFunction
Returns a new instance of thisUnitaryFunction
- Specified by:
getInstance
in classUnitaryFunction
- Parameters:
function
- theGeneralFunction
to be operated on- Returns:
- a new instance of this
UnitaryFunction
-
execute
Execution is not supported by this class, as it is purely an intermediary- Specified by:
execute
in classTransformation
- Returns:
- nothing, because this method will always throw an error
- Throws:
UnsupportedOperationException
- whenever this method is called
-
toOutputFunction
Description copied from interface:Outputable
Converts this function into anOutputFunction
for use in string conversion- Specified by:
toOutputFunction
in interfaceOutputable
- Overrides:
toOutputFunction
in classUnitaryFunction
- Returns:
- this function as an
OutputFunction
-