Class Root


public class Root extends FunctionalTerm
This class represents a the nth root function
Author:
Matthias Thimm
  • Constructor Details

    • Root

      public Root(Term term)
      Creates a new square root.
      Parameters:
      term - the term inside the square root
    • Root

      public Root(Term term, Term base)
      Creates a new root for the given base.
      Parameters:
      term - the term inside the square root
      base - the base of the root
  • Method Details

    • replaceTerm

      public Term replaceTerm(Term toSubstitute, Term substitution)
      Description copied from class: Term
      Replaces each occurrence of "toSubstitute" by "substitution" and return the new term.
      Specified by:
      replaceTerm in class FunctionalTerm
      Parameters:
      toSubstitute - the term to be substituted
      substitution - the new term
      Returns:
      this term where "toSubstitute" is replaced by "substitution"
    • toString

      public String toString()
      Specified by:
      toString in class FunctionalTerm
    • value

      public Constant value() throws IllegalArgumentException
      Description copied from class: Term
      Computes the actual value of this term if it contains no variables.
      Specified by:
      value in class FunctionalTerm
      Returns:
      the value of this term, either a float or an integer.
      Throws:
      IllegalArgumentException - if this term contains at least on variable.
    • isContinuous

      public boolean isContinuous(Variable v)
      Description copied from class: Term
      Checks whether this term is continuous in v.
      Specified by:
      isContinuous in class Term
      Parameters:
      v - a variable
      Returns:
      "true" iff this term is continuous in v.
    • simplify

      public Term simplify()
      Description copied from class: Term
      Simplifies this term in an equivalent way:
      - Replaces products that contain a zero by the constant zero
      - Removes a term one from products
      - Removes a term zero from sums
      - Aggregates constants in sums, products, and minimums
      - Evaluates functional terms on constants
      - Simplifies fractions where possible.
      Specified by:
      simplify in class Term
      Returns:
      the simplified term.
    • derive

      public Term derive(Variable v) throws NonDifferentiableException
      Description copied from class: Term
      Differentiates the term with respect to the given variable.
      Specified by:
      derive in class Term
      Parameters:
      v - a variable.
      Returns:
      the derivation of this term wrt. the given variable.
      Throws:
      NonDifferentiableException - if the term cannot be differentiated.
    • getTerms

      public List<Term> getTerms()
      Specified by:
      getTerms in class Term