Package functions.binary
Class Pow
Object
- All Implemented Interfaces:
- Differentiable,- Evaluable,- Outputable,- Simplifiable,- Comparable<GeneralFunction>,- Iterable<GeneralFunction>
public class Pow extends BinaryFunction
- 
Field Summary
- 
Constructor SummaryConstructors Constructor Description Pow(GeneralFunction exponent, GeneralFunction base)Constructs a newPow
- 
Method SummaryModifier and Type Method Description Powclone()Returns a clone of thisGeneralFunctionProductdistributeExponents()Returns aProductwhere the exponent is distributed to each term.doubleevaluate(Map<String,Double> variableValues)Evaluates aGeneralFunctionat a point denoted by aMapGeneralFunctiongetDerivative(String varID)Returns the derivative of aGeneralFunctionwith respect to a variable.BinaryFunctiongetInstance(GeneralFunction function1, GeneralFunction function2)Returns an instance of thisGeneralFunction, using the correct subclassPowmultiplyExponents()Simplifies instances of a power raised to a power.GeneralFunctionsimplify()Returns thisGeneralFunction, simplifiedGeneralFunctionsimplifyFOC()GeneralFunctionsimplifyLogsOfSameBase()If the exponent is a logarithm with the same base as thePow, it returns the argument of the logarithmGeneralFunctionsimplifyObviousExponentsAndFOC()Returns aGeneralFunctionwhere obvious exponents (ex:(x+1)^1 or (x-1)^0) have been simplified and functions of constants (ex:2^7) are simplifiedOutputFunctiontoOutputFunction()Converts this function into anOutputFunctionfor use in string conversionGeneralFunctiontoSpecialCase()StringtoString()Returns a String representation of thisGeneralFunctionProductunwrapIntegerPower()GeneralFunctionunwrapIntegerPowerSafe()Given aPow, checks if the exponent is a positive integer, and if so, appliesunwrapIntegerPower()Methods inherited from class BinaryFunctioncompareSelf, equalsFunction, getFunction1, getFunction2, hashCode, iterator, substituteAllMethods inherited from class GeneralFunctioncompareTo, derivativeAt, equals, equalsSimplified, getNthDerivative, getSimplifiedDerivative, substituteVariables
- 
Constructor Details
- 
Method Details- 
evaluatepublic double evaluate(Map<String,Double> variableValues)Description copied from interface:EvaluableEvaluates aGeneralFunctionat a point denoted by aMap- Parameters:
- variableValues- the values of the variables in the- GeneralFunctionat the point
- Returns:
- the value of the GeneralFunctionat the point
 
- 
getDerivativeDescription copied from interface:DifferentiableReturns the derivative of aGeneralFunctionwith 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
 
- 
getInstanceDescription copied from class:BinaryFunctionReturns an instance of thisGeneralFunction, using the correct subclass- Specified by:
- getInstancein class- BinaryFunction
- Parameters:
- function1- Constructor parameter 1
- function2- Constructor parameter 2
- Returns:
- an instance of this GeneralFunction
 
- 
cloneDescription copied from class:GeneralFunctionReturns a clone of thisGeneralFunction- Specified by:
- clonein class- GeneralFunction
- Returns:
- a clone of this function
 
- 
toSpecialCase
- 
toStringpublic String toString()Description copied from class:GeneralFunctionReturns a String representation of thisGeneralFunction- Specified by:
- toStringin class- GeneralFunction
- Returns:
- String representation of this function
 
- 
simplifyDescription copied from interface:SimplifiableReturns thisGeneralFunction, simplified- Returns:
- the simplified function
 
- 
simplifyObviousExponentsAndFOCReturns aGeneralFunctionwhere obvious exponents (ex:(x+1)^1 or (x-1)^0) have been simplified and functions of constants (ex:2^7) are simplified- Returns:
- a GeneralFunctionwhere obvious exponents and functions of constants are simplified
 
- 
simplifyFOCDescription copied from class:BinaryFunction- Overrides:
- simplifyFOCin class- BinaryFunction
- Returns:
- a new Constantof theBinaryFunctionevaluated if both operands are aConstant
 
- 
multiplyExponentsSimplifies instances of a power raised to a power. Example:(x^2)^3 = x^6- Returns:
- a Powwhere the exponents are multiplied
 
- 
distributeExponentsReturns aProductwhere the exponent is distributed to each term. Example:(xy)^2 = (x^2)(y^2)- Returns:
- a Productwith the exponent distributed
 
- 
unwrapIntegerPowerSafeGiven aPow, checks if the exponent is a positive integer, and if so, appliesunwrapIntegerPower()- Returns:
- thisor a new unwrapped- Product
 
- 
unwrapIntegerPower- Returns:
- a new unwrapped Product
- Throws:
- RuntimeException- if the exponent is not a positive integer
 
- 
simplifyLogsOfSameBaseIf the exponent is a logarithm with the same base as thePow, it returns the argument of the logarithm- Returns:
- the argument of the logarithm in the exponent, if the exponent is a logarithm with the same base as the Pow
 
- 
toOutputFunctionDescription copied from interface:OutputableConverts this function into anOutputFunctionfor use in string conversion- Specified by:
- toOutputFunctionin interface- Outputable
- Overrides:
- toOutputFunctionin class- BinaryFunction
- Returns:
- this function as an OutputFunction
 
 
-