Class Exmonomial

java.lang.Object
org.oristool.math.expression.Exmonomial

public final class Exmonomial extends Object
A constant term multiplied by a set of AtomicTerm.
  • Constructor Details

    • Exmonomial

      public Exmonomial(OmegaBigDecimal constantTerm)
      Builds a constant instance.
      Parameters:
      constantTerm - the constant value
    • Exmonomial

      public Exmonomial(BigDecimal constantTerm)
    • Exmonomial

      public Exmonomial(Exmonomial exmon)
      Builds a copy of the input instance.
      Parameters:
      exmon - input instance
  • Method Details

    • getConstantTerm

      public OmegaBigDecimal getConstantTerm()
      Gets the constant multiplier of the term.
      Returns:
      constant multiplier
    • setConstantTerm

      public void setConstantTerm(OmegaBigDecimal constantTerm)
      Sets the constant multiplier of the term.
      Parameters:
      constantTerm - constant multiplier to set
    • getAtomicTerms

      public List<AtomicTerm> getAtomicTerms()
      Gets the variable atomic terms of the exmonomial.
      Returns:
      the atomic terms
    • addAtomicTerm

      public void addAtomicTerm(AtomicTerm term)
      Adds a new atomic term to the product.
      Parameters:
      term - the atomic term to be added
    • getVariables

      public Collection<Variable> 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

      public void multiply(Exmonomial exmon)
      Multiplies this term by an input exmonomial.
      Parameters:
      exmon - input exmonomial
    • multiply

      public void multiply(OmegaBigDecimal c)
      Multiplies this exmonomial by a constant.
      Parameters:
      c - constant
    • isSameForm

      public boolean isSameForm(Exmonomial exmon)
      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

      public void divide(BigDecimal k)
      Divides by a constant and normalizes.
      Parameters:
      k - constant
    • substitute

      public void substitute(Variable oldVar, Variable newVar)
      Replaces oldVar with newVar.
      Parameters:
      oldVar - variable to be replaced
      newVar - new variable
    • integrate

      public Expolynomial integrate(Variable var)
      Computes the primitive function of this exmonomial.
      Parameters:
      var - integration variable
      Returns:
      primitive function
    • integrate

      public Expolynomial integrate(Variable var, OmegaBigDecimal lower, OmegaBigDecimal upper)
      Integrates this exmonomial over an interval.
      Parameters:
      var - integration variable
      lower - lower bound
      upper - upper bound
      Returns:
      definite integral value
    • shift

      public Expolynomial shift(Variable base, Variable offset)
      Replaces base with base + offset.
      Parameters:
      base - variable to be replaced
      offset - offset to be applied
      Returns:
      resulting expolynomial
    • evaluate

      Evaluates the exmonomial.
      Parameters:
      m - map with values for all the variables
      Returns:
      exmonomial value
    • evaluate

      public Exmonomial evaluate(Variable var, OmegaBigDecimal value)
      Replaces a variable with its value.
      Parameters:
      var - variable to be replaced
      value - value of the variable
      Returns:
      exmonomial after the substitution
    • evaluate

      public Expolynomial evaluate(Variable base, Boolean sign, Variable offset, BigDecimal constant)
      Replaces base with +/- offset + constant.
      Parameters:
      base - variable to be replaced
      sign - true if sign of the offset is positive
      offset - offset to be added
      constant - constant to be added
      Returns:
      resulting Expolynomial
    • evaluate

      public Expolynomial evaluate(Variable base, Boolean sign1, Variable offset1, Boolean sign2, Variable offset2, BigDecimal constant)
      Replaces base with +/- offset1 +/- offset2 + constant.
      Parameters:
      base - variable to be replaced
      sign1 - true if sign of the first offset is positive
      offset1 - first offset to be added
      sign2 - true if sign of the second offset is positive
      offset2 - second offset to be added
      constant - constant to be added
      Returns:
      resulting Expolynomial
    • toString

      public String toString()
      Overrides:
      toString in class Object