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 aVariableDifferential(GeneralFunction variable)Constructs a newDifferential, which is sometimes used as an intermediary for integrals and derivatives, assuming that the operand is a variableVariableDifferential(String respectTo)Constructs a newDifferential, which is sometimes used as an intermediary for integrals and derivatives -
Method Summary
Modifier and Type Method Description UnitaryFunctionclone()Returns a clone of thisGeneralFunctionintcompareSelf(GeneralFunction that)Used internally for comparing two functions of the same exact typebooleanequalsFunction(GeneralFunction that)Returns true when the two fully-simplified functions are equaldoubleevaluate(Map<String,Double> variableValues)Differentiation is not supported by this class, as it is purely an intermediaryGeneralFunctionexecute()Execution is not supported by this class, as it is purely an intermediaryGeneralFunctiongetDerivative(String varID)Evaluation is not supported by this class, as it is purely an intermediaryUnitaryFunctiongetInstance(GeneralFunction function)Returns a new instance of thisUnitaryFunctionUnitaryFunctionsimplify()Returns thisGeneralFunction, simplifiedUnitaryFunctionsimplifyInternal()Simplifies theUnitaryFunction.operandusingSimplifiable.simplify()GeneralFunctionsubstituteVariables(Map<String,? extends GeneralFunction> toSubstitute)Substitutes variables with functions as specified in a mapOutputFunctiontoOutputFunction()Converts this function into anOutputFunctionfor use in string conversionStringtoString()Returns a String representation of thisGeneralFunctionMethods inherited from class UnitaryFunction
hashCode, iterator, newInstanceOf, simplifyFOC, simplifyInverse, substituteAllMethods 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:GeneralFunctionReturns a String representation of thisGeneralFunction- Overrides:
toStringin classUnitaryFunction- Returns:
- String representation of this function
-
clone
Description copied from class:GeneralFunctionReturns a clone of thisGeneralFunction- Overrides:
clonein classUnitaryFunction- Returns:
- a clone of this function
-
substituteVariables
Description copied from class:GeneralFunctionSubstitutes variables with functions as specified in a map- Overrides:
substituteVariablesin classGeneralFunction- Parameters:
toSubstitute- the map betweenVariablestrings andGeneralFunctions- Returns:
- the new
GeneralFunctionafter all substitutions are preformed
-
equalsFunction
Description copied from class:GeneralFunctionReturns true when the two fully-simplified functions are equal- Overrides:
equalsFunctionin classUnitaryFunction- Parameters:
that- TheGeneralFunctionthat the current function is being checked against- Returns:
- true if the two functions are equal
-
compareSelf
Description copied from class:GeneralFunctionUsed internally for comparing two functions of the same exact type- Overrides:
compareSelfin classUnitaryFunction- Parameters:
that- theGeneralFunctionthat 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:SimplifiableReturns thisGeneralFunction, simplified- Specified by:
simplifyin interfaceSimplifiable- Overrides:
simplifyin classTransformation- Returns:
- the simplified function
-
simplifyInternal
Description copied from class:UnitaryFunctionSimplifies theUnitaryFunction.operandusingSimplifiable.simplify()- Overrides:
simplifyInternalin classUnitaryFunction- Returns:
- an instance of this
UnitaryFunctionwith theUnitaryFunction.operandsimplified
-
getInstance
Description copied from class:UnitaryFunctionReturns a new instance of thisUnitaryFunction- Specified by:
getInstancein classUnitaryFunction- Parameters:
function- theGeneralFunctionto 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:
executein classTransformation- Returns:
- nothing, because this method will always throw an error
- Throws:
UnsupportedOperationException- whenever this method is called
-
toOutputFunction
Description copied from interface:OutputableConverts this function into anOutputFunctionfor use in string conversion- Specified by:
toOutputFunctionin interfaceOutputable- Overrides:
toOutputFunctionin classUnitaryFunction- Returns:
- this function as an
OutputFunction
-