public abstract class Term
extends java.lang.Object
Constructor and Description |
---|
Term() |
Modifier and Type | Method and Description |
---|---|
Sum |
add(Term t)
Returns the sum of this and the given term.
|
abstract void |
collapseAssociativeOperations()
This method collapses all associative operations appearing
in this term, e.g.
|
abstract Term |
derive(Variable v)
Differentiates the term with respect to the given variable.
|
double |
doubleValue()
Computes the actual value of this term if it contains no variables.
|
static double[][] |
evaluateMatrix(java.util.List<java.util.List<Term>> functions,
double[] values,
java.util.List<Variable> variables)
Evaluates each function in the given matrix with the given values for variables.
|
static double[] |
evaluateVector(java.util.List<Term> functions,
double[] values,
java.util.List<Variable> variables)
Evaluates each function in the given list with the given values for variables.
|
static java.util.List<java.lang.Double> |
evaluateVector(java.util.List<Term> functions,
java.util.Map<Variable,? extends Term> mapping)
Evaluates each function in the given list with the given values for variables.
|
abstract void |
expandAssociativeOperations()
This method expands all associative operations appearing
in this term, e.g.
|
abstract java.util.Set<AbsoluteValue> |
getAbsoluteValues()
Returns all absolute values of this term.
|
abstract java.util.Set<Maximum> |
getMaximums()
Returns all maximums of this term.
|
abstract java.util.Set<Minimum> |
getMinimums()
Returns all minimums of this term.
|
abstract java.util.Set<Product> |
getProducts()
Returns all products of this term.
|
abstract java.util.Set<Variable> |
getVariables()
Returns all variables in this term.
|
boolean |
isContinuous()
Checks whether this term is continuous in all appearing variables.
|
abstract boolean |
isContinuous(Variable v)
Checks whether this term is continuous in v.
|
abstract boolean |
isInteger()
Checks whether this term represents an integer value.
|
boolean |
isLinear()
Checks whether this term is linear.
|
Term |
min(Term t)
Returns the minimum of this and the given term.
|
Difference |
minus(Term t)
Returns the sum of this and (-1) * the given term.
|
Product |
mult(Term t)
Returns the product of this and the given term.
|
Term |
replaceAllTerms(double[] values,
java.util.List<Variable> variables)
Replaces terms according to the given map.
|
Term |
replaceAllTerms(java.util.Map<? extends Term,? extends Term> substitutes)
Replaces terms according to the given map.
|
abstract Term |
replaceTerm(Term toSubstitute,
Term substitution)
Replaces each occurrence of "toSubstitute" by "substitution" and
return the new term.
|
abstract 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. |
abstract Sum |
toLinearForm()
Converts this term into a linear normal form, i.e.
|
abstract java.lang.String |
toString() |
abstract Constant |
value()
Computes the actual value of this term if it contains no variables.
|
public Sum add(Term t)
t
- a termpublic Difference minus(Term t)
t
- a termpublic Product mult(Term t)
t
- a term.public Term min(Term t)
t
- a term.public abstract Constant value() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if this term contains at least on
variable.public double doubleValue() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if this term contains at least on
variable.public abstract boolean isContinuous(Variable v)
public boolean isContinuous()
public abstract java.util.Set<Variable> getVariables()
public abstract java.util.Set<Product> getProducts()
public abstract java.util.Set<Minimum> getMinimums()
public abstract java.util.Set<Maximum> getMaximums()
public abstract java.util.Set<AbsoluteValue> getAbsoluteValues()
public abstract boolean isInteger()
public abstract Sum toLinearForm() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if this term cannot be
converted into a linear normal form.public abstract Term replaceTerm(Term toSubstitute, Term substitution)
toSubstitute
- the term to be substitutedsubstitution
- the new termpublic static java.util.List<java.lang.Double> evaluateVector(java.util.List<Term> functions, java.util.Map<Variable,? extends Term> mapping)
functions
- mapping
- public static double[] evaluateVector(java.util.List<Term> functions, double[] values, java.util.List<Variable> variables)
functions
- values
- the values of the variablesvariables
- the (ordered) list of variablespublic static double[][] evaluateMatrix(java.util.List<java.util.List<Term>> functions, double[] values, java.util.List<Variable> variables)
functions
- values
- the values of the variablesvariables
- the (ordered) list of variablespublic Term replaceAllTerms(double[] values, java.util.List<Variable> variables)
values
- an array of values.variables
- A list of variables that shall be substituted by the given valuespublic Term replaceAllTerms(java.util.Map<? extends Term,? extends Term> substitutes)
substitutes
- a map.public boolean isLinear()
public abstract Term simplify()
public abstract Term derive(Variable v) throws NonDifferentiableException
v
- a variable.NonDifferentiableException
- if the term cannot be
differentiated.public abstract void collapseAssociativeOperations()
public abstract void expandAssociativeOperations()
public abstract java.lang.String toString()
toString
in class java.lang.Object