Package functions.commutative
Class Product
Object
GeneralFunction
CommutativeFunction
Product
- All Implemented Interfaces:
 Differentiable,Evaluable,Outputable,Simplifiable,Comparable<GeneralFunction>,Iterable<GeneralFunction>
public class Product extends CommutativeFunction
- 
Field Summary
 - 
Constructor Summary
Constructors Constructor Description Product(GeneralFunction... functions)Constructs a newProduct - 
Method Summary
Modifier and Type Method Description ProductaddExponents()IfCommutativeFunction.functionscontains multiple functions that are equal to each other, including the bases ofPows, then the exponents are added and the terms are combined.Productclone()Returns a clone of thisGeneralFunctionintcompareSelf(GeneralFunction that)Used internally for comparing two functions of the same exact typeGeneralFunctiondistributeAll()If one element of the product is aSum, distributes the other contents of the product onto the sum.doubleevaluate(Map<String,Double> variableValues)Evaluates aGeneralFunctionat a point denoted by aMapProductfixNullIntegrals()Turns constructs like a null-respect integral times\dxinto an integral with respect to'x'GeneralFunctiongetDerivative(String varID)Returns the derivative of aGeneralFunctionwith respect to a variable.doublegetIdentityValue()Returns the identity of thisCommutativeFunction, such as 0 for + or gcd and 1 for * or lcmCommutativeFunctiongetInstance(GeneralFunction... functions)Returns an instance of thisGeneralFunctionprotected Collector<CharSequence,?,String>getJoiningCollector()Returns a collector used to create thetoStringof theCommutativeFunctionbooleanisTimesZero()doubleoperate(double a, double b)Performs the operation of thisCommutativeFunctionon the two inputsGeneralFunctionsimplify()Returns thisGeneralFunction, simplifiedProductsimplifyInternal()Simplifies thisCommutativeFunctionusing all methods that are guaranteed to return aCommutativeFunctionof the same typeOutputFunctiontoOutputFunction()Converts this function into anOutputFunctionfor use in string conversionMethods inherited from class CommutativeFunction
equalsFunction, getFunctions, hashCode, iterator, simplifyConstants, simplifyElements, simplifyIdentity, simplifyPull, simplifyTrivialElement, substituteAll, toStringMethods inherited from class GeneralFunction
compareTo, derivativeAt, equals, equalsSimplified, getNthDerivative, getSimplifiedDerivative, substituteVariables 
- 
Constructor Details
 - 
Method Details
- 
evaluate
public 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 theGeneralFunctionat the point- Returns:
 - the value of the 
GeneralFunctionat the point 
 - 
getDerivative
Description 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 
 - 
getInstance
Description copied from class:CommutativeFunctionReturns an instance of thisGeneralFunction- Specified by:
 getInstancein classCommutativeFunction- Parameters:
 functions- theGeneralFunctions that will be acted on- Returns:
 - an instance of this 
GeneralFunction 
 - 
clone
Description copied from class:GeneralFunctionReturns a clone of thisGeneralFunction- Specified by:
 clonein classGeneralFunction- Returns:
 - a clone of this function
 
 - 
getJoiningCollector
protected Collector<CharSequence,?,String> getJoiningCollector()Description copied from class:CommutativeFunctionReturns a collector used to create thetoStringof theCommutativeFunction- Overrides:
 getJoiningCollectorin classCommutativeFunction- Returns:
 - a joining collector
 
 - 
compareSelf
Description copied from class:GeneralFunctionUsed internally for comparing two functions of the same exact type- Overrides:
 compareSelfin classCommutativeFunction- Parameters:
 that- theGeneralFunctionthat this is compared against- Returns:
 - the comparison
 
 - 
simplify
Description copied from interface:SimplifiableReturns thisGeneralFunction, simplified- Specified by:
 simplifyin interfaceSimplifiable- Overrides:
 simplifyin classCommutativeFunction- Returns:
 - the simplified function
 
 - 
simplifyInternal
Description copied from class:CommutativeFunctionSimplifies thisCommutativeFunctionusing all methods that are guaranteed to return aCommutativeFunctionof the same type- Overrides:
 simplifyInternalin classCommutativeFunction- Returns:
 - the simplified 
CommutativeFunction 
 - 
isTimesZero
public boolean isTimesZero() - 
addExponents
IfCommutativeFunction.functionscontains multiple functions that are equal to each other, including the bases ofPows, then the exponents are added and the terms are combined. Ex:sin(x)*(sin(x))^2becomes(sin(x))^3- Returns:
 - A new 
Productwith exponents combined as specified above 
 - 
fixNullIntegrals
Turns constructs like a null-respect integral times\dxinto an integral with respect to'x'- Returns:
 - this function with null-integrals fixed, if possible
 
 - 
distributeAll
If one element of the product is aSum, distributes the other contents of the product onto the sum. Example:sin(y)*(x+2) = x*sin(y) + 2*sin(y)- Returns:
 - this function with multiplication and addition distributed if possible
 
 - 
getIdentityValue
public double getIdentityValue()Description copied from class:CommutativeFunctionReturns the identity of thisCommutativeFunction, such as 0 for + or gcd and 1 for * or lcm- Specified by:
 getIdentityValuein classCommutativeFunction- Returns:
 - the identity of this 
CommutativeFunction 
 - 
operate
public double operate(double a, double b)Description copied from class:CommutativeFunctionPerforms the operation of thisCommutativeFunctionon the two inputs- Specified by:
 operatein classCommutativeFunction- Parameters:
 a- the first inputb- the second input- Returns:
 - the operation applied to the inputs
 
 - 
toOutputFunction
Description copied from interface:OutputableConverts this function into anOutputFunctionfor use in string conversion- Specified by:
 toOutputFunctionin interfaceOutputable- Overrides:
 toOutputFunctionin classCommutativeFunction- Returns:
 - this function as an 
OutputFunction 
 
 -