Package org.oristool.math.expression
Class Exmonomial
java.lang.Object
org.oristool.math.expression.Exmonomial
A constant term multiplied by a set of
AtomicTerm
.-
Constructor Summary
ConstructorDescriptionExmonomial
(BigDecimal constantTerm) Exmonomial
(Exmonomial exmon) Builds a copy of the input instance.Exmonomial
(OmegaBigDecimal constantTerm) Builds a constant instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAtomicTerm
(AtomicTerm term) Adds a new atomic term to the product.void
divide
(BigDecimal k) Divides by a constant and normalizes.Evaluates the exmonomial.evaluate
(Variable base, Boolean sign1, Variable offset1, Boolean sign2, Variable offset2, BigDecimal constant) Replacesbase
with +/-offset1
+/-offset2
+constant
.evaluate
(Variable base, Boolean sign, Variable offset, BigDecimal constant) Replacesbase
with +/-offset
+constant
.evaluate
(Variable var, OmegaBigDecimal value) Replaces a variable with its value.Gets the variable atomic terms of the exmonomial.Gets the constant multiplier of the term.Collects the variable names of the exmonomial.Computes the primitive function of this exmonomial.integrate
(Variable var, OmegaBigDecimal lower, OmegaBigDecimal upper) Integrates this exmonomial over an interval.boolean
isSameForm
(Exmonomial exmon) Checks whether the input exmonomial has the same set of terms.void
multiply
(Exmonomial exmon) Multiplies this term by an input exmonomial.void
Multiplies this exmonomial by a constant.void
Normalizes the exmonomial to avoid multiple powers (or exponentials) for the same variable.void
setConstantTerm
(OmegaBigDecimal constantTerm) Sets the constant multiplier of the term.Replacesbase
withbase
+offset
.void
substitute
(Variable oldVar, Variable newVar) ReplacesoldVar
withnewVar
.toString()
-
Constructor Details
-
Exmonomial
Builds a constant instance.- Parameters:
constantTerm
- the constant value
-
Exmonomial
-
Exmonomial
Builds a copy of the input instance.- Parameters:
exmon
- input instance
-
-
Method Details
-
getConstantTerm
Gets the constant multiplier of the term.- Returns:
- constant multiplier
-
setConstantTerm
Sets the constant multiplier of the term.- Parameters:
constantTerm
- constant multiplier to set
-
getAtomicTerms
Gets the variable atomic terms of the exmonomial.- Returns:
- the atomic terms
-
addAtomicTerm
Adds a new atomic term to the product.- Parameters:
term
- the atomic term to be added
-
getVariables
Collects the variable names of the exmonomial.- Returns:
- variable names of all terms
-
normalize
public void normalize()Normalizes the exmonomial to avoid multiple powers (or exponentials) for the same variable. -
multiply
Multiplies this term by an input exmonomial.- Parameters:
exmon
- input exmonomial
-
multiply
Multiplies this exmonomial by a constant.- Parameters:
c
- constant
-
isSameForm
Checks whether the input exmonomial has the same set of terms.Both exmonomials must be normalized first.
- Parameters:
exmon
- input exmonomial- Returns:
- true if both exmonomials have the same set of terms.
-
divide
Divides by a constant and normalizes.- Parameters:
k
- constant
-
substitute
ReplacesoldVar
withnewVar
.- Parameters:
oldVar
- variable to be replacednewVar
- new variable
-
integrate
Computes the primitive function of this exmonomial.- Parameters:
var
- integration variable- Returns:
- primitive function
-
integrate
Integrates this exmonomial over an interval.- Parameters:
var
- integration variablelower
- lower boundupper
- upper bound- Returns:
- definite integral value
-
shift
Replacesbase
withbase
+offset
.- Parameters:
base
- variable to be replacedoffset
- offset to be applied- Returns:
- resulting expolynomial
-
evaluate
Evaluates the exmonomial.- Parameters:
m
- map with values for all the variables- Returns:
- exmonomial value
-
evaluate
Replaces a variable with its value.- Parameters:
var
- variable to be replacedvalue
- value of the variable- Returns:
- exmonomial after the substitution
-
evaluate
Replacesbase
with +/-offset
+constant
.- Parameters:
base
- variable to be replacedsign
- true if sign of the offset is positiveoffset
- offset to be addedconstant
- constant to be added- Returns:
- resulting
Expolynomial
-
evaluate
public Expolynomial evaluate(Variable base, Boolean sign1, Variable offset1, Boolean sign2, Variable offset2, BigDecimal constant) Replacesbase
with +/-offset1
+/-offset2
+constant
.- Parameters:
base
- variable to be replacedsign1
- true if sign of the first offset is positiveoffset1
- first offset to be addedsign2
- true if sign of the second offset is positiveoffset2
- second offset to be addedconstant
- constant to be added- Returns:
- resulting
Expolynomial
-
toString
-