Package org.tweetyproject.math.term
Class Difference
java.lang.Object
org.tweetyproject.math.term.Term
org.tweetyproject.math.term.Difference
This class models a difference between two terms.
- Author:
- Matthias Thimm
-
Constructor Summary
ConstructorsConstructorDescriptionDifference(Term first, Term second) Creates a new difference with the given terms. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method collapses all associative operations appearing in this term, e.g.Differentiates the term with respect to the given variable.voidThis method expands all associative operations appearing in this term, e.g.Returns all absolute values of this term.Returns all maximums of this term.Returns all minimums of this term.Returns all products of this term.getSums()Returns all sums of this term.getTerms()Returns all variables in this term.booleanChecks whether this term is continuous in v.booleanChecks whether this term represents an integer value.replaceTerm(Term toSubstitute, Term substitution) Replaces each occurrence of "toSubstitute" by "substitution" and return the new term.simplify()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.Converts this term into a linear normal form, i.e.toString()value()Computes the actual value of this term if it contains no variables.Methods inherited from class org.tweetyproject.math.term.Term
add, doubleValue, evaluateMatrix, evaluateVector, evaluateVector, isContinuous, isLinear, isQuadratic, min, minus, mult, replaceAllTerms, replaceAllTerms
-
Constructor Details
-
Difference
Creates a new difference with the given terms.- Parameters:
first- a term.second- a term.
-
-
Method Details
-
value
Description copied from class:TermComputes the actual value of this term if it contains no variables. -
replaceTerm
Description copied from class:TermReplaces each occurrence of "toSubstitute" by "substitution" and return the new term.- Specified by:
replaceTermin classTerm- Parameters:
toSubstitute- the term to be substitutedsubstitution- the new term- Returns:
- this term where "toSubstitute" is replaced by "substitution"
-
expandAssociativeOperations
public void expandAssociativeOperations()Description copied from class:TermThis method expands all associative operations appearing in this term, e.g. every min{a,b,c} becomes min{min{a,b},c}.- Specified by:
expandAssociativeOperationsin classTerm
-
toQuadraticForm
- Specified by:
toQuadraticFormin classTerm- Throws:
IllegalArgumentException
-
toLinearForm
Description copied from class:TermConverts this term into a linear normal form, i.e. into a sum of products of a constant and a variable.- Specified by:
toLinearFormin classTerm- Returns:
- a term in linear normal form.
- Throws:
IllegalArgumentException- if this term cannot be converted into a linear normal form.
-
derive
Description copied from class:TermDifferentiates the term with respect to the given variable.- Specified by:
derivein classTerm- Parameters:
v- a variable.- Returns:
- the derivation of this term wrt. the given variable.
- Throws:
NonDifferentiableException- if the term cannot be differentiated.
-
isContinuous
Description copied from class:TermChecks whether this term is continuous in v.- Specified by:
isContinuousin classTerm- Parameters:
v- a variable- Returns:
- "true" iff this term is continuous in v.
-
simplify
Description copied from class:TermSimplifies 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. -
toString
-
getVariables
Description copied from class:TermReturns all variables in this term.- Specified by:
getVariablesin classTerm- Returns:
- all variables in this term.
-
getProducts
Description copied from class:TermReturns all products of this term.- Specified by:
getProductsin classTerm- Returns:
- all products of this term.
-
getSums
Description copied from class:TermReturns all sums of this term. -
getMinimums
Description copied from class:TermReturns all minimums of this term.- Specified by:
getMinimumsin classTerm- Returns:
- all minimums of this term.
-
getMaximums
Description copied from class:TermReturns all maximums of this term.- Specified by:
getMaximumsin classTerm- Returns:
- all maximums of this term.
-
getAbsoluteValues
Description copied from class:TermReturns all absolute values of this term.- Specified by:
getAbsoluteValuesin classTerm- Returns:
- all absolute values of this term.
-
isInteger
public boolean isInteger()Description copied from class:TermChecks whether this term represents an integer value. -
collapseAssociativeOperations
public void collapseAssociativeOperations()Description copied from class:TermThis method collapses all associative operations appearing in this term, e.g. every min{min{a,b},c} becomes min{a,b,c}.- Specified by:
collapseAssociativeOperationsin classTerm
-
getTerms
-