|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFunction<R,R>
Polynomial<R>
public class Polynomial<R extends Ring<R>>
This class represents a mathematical expression involving a sum of powers
in one or more variables multiplied by
coefficients (such as x² + x·y + 3y²).
Polynomials are characterized by the type of variable they operate
upon. For example:
are two different polynomials, the first one operates on physical
Variable<Amount<?>> varX = new Variable.Local<Amount<?>>("x");
Polynomial<Amount<?>> x = Polynomial.valueOf(Amount.valueOf(1, SI.METRE), varX);
and
Variable<Complex> varX = new Variable.Local<Complex>("x");
Polynomial<Complex> x = Polynomial.valueOf(Complex.ONE, varX);measures,
whereas the second operates on
complex numbers.
Terms (others than ONE) having zero (additive identity)
for coefficient are automatically removed.
| Method Summary | ||
|---|---|---|
|
compose(Function<Z,R> that)
Returns the composition of this function with the one specified. |
|
Polynomial<R> |
compose(Polynomial<R> that)
Returns the composition of this polynomial with the one specified. |
|
Polynomial<R> |
copy()
Returns a copy of this polynomial allocated
by the calling thread (possibly on the stack). |
|
Polynomial<R> |
differentiate(Variable<R> v)
Returns the first derivative of this function with respect to the specified variable. |
|
boolean |
equals(Object obj)
Indicates if this function is equals to the specified object. |
|
R |
evaluate()
Evaluates this function using its variables current
values. |
|
R |
getCoefficient(Term term)
Returns the coefficient for the specified term. |
|
int |
getOrder(Variable<R> v)
Returns the order of this polynomial for the specified variable. |
|
Set<Term> |
getTerms()
Returns the terms of this polynomial. |
|
List<Variable<R>> |
getVariables()
Returns a lexically ordered list of the variables (or arguments) for this function (empty list for constant functions). |
|
int |
hashCode()
Returns the hash code for this function (consistent with Function.equals(Object). |
|
Polynomial<R> |
integrate(Variable<R> v)
Returns an integral of this function with respect to the specified variable. |
|
Function<R,R> |
minus(Function<R,R> that)
Returns the difference of this function with the one specified. |
|
Polynomial<R> |
minus(Polynomial<R> that)
Returns the difference of two polynomials. |
|
Polynomial<R> |
opposite()
Returns the opposite of this polynomial. |
|
Function<R,R> |
plus(Function<R,R> that)
Returns the sum of this function with the one specified. |
|
Polynomial<R> |
plus(Polynomial<R> that)
Returns the sum of two polynomials. |
|
Polynomial<R> |
plus(R constantValue)
Returns the sum of this polynomial with a constant polynomial having the specified value (convenience method). |
|
Polynomial<R> |
pow(int n)
Returns this function raised at the specified exponent. |
|
Function<R,R> |
times(Function<R,R> that)
Returns the product of this function with the one specified. |
|
Polynomial<R> |
times(Polynomial<R> that)
Returns the product of two polynomials. |
|
Polynomial<R> |
times(R constantValue)
Returns the product of this polynomial with a constant polynomial having the specified value (convenience method). |
|
Text |
toText()
Returns the textual representation of this real-time object (equivalent to toString except that the returned value
can be allocated from the local context space). |
|
static
|
valueOf(R coefficient,
Term term)
Returns a polynomial corresponding to the specified term
with the specified coefficient multiplier. |
|
static
|
valueOf(R coefficient,
Variable<R> variable)
Returns an univariate polynomial of degree one with the specified coefficient multiplier. |
|
| Methods inherited from class Function |
|---|
divide, evaluate, evaluate, getVariable, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <R extends Ring<R>> Polynomial<R> valueOf(R coefficient,
Variable<R> variable)
coefficient - the coefficient for the variable of degree 1.variable - the variable for this polynomial.
valueOf(coefficient, Term.valueOf(variable, 1))
public static <R extends Ring<R>> Polynomial<R> valueOf(R coefficient,
Term term)
term
with the specified coefficient multiplier.
coefficient - the coefficient multiplier.term - the term multiplicand.
coefficient * termpublic Set<Term> getTerms()
public final R getCoefficient(Term term)
term - the term for which the coefficient is returned.
null
if this polynomial does not contain the specified term.public int getOrder(Variable<R> v)
public Polynomial<R> plus(R constantValue)
constantValue - the value of the constant polynomial to add.
this + Constant.valueOf(constantValue)public Polynomial<R> times(R constantValue)
constantValue - the value of the constant polynomial to multiply.
this · Constant.valueOf(constantValue)public Polynomial<R> plus(Polynomial<R> that)
plus in interface GroupAdditive<Polynomial<R extends Ring<R>>>that - the polynomial being added.
this + thatpublic Polynomial<R> opposite()
opposite in interface GroupAdditive<Polynomial<R extends Ring<R>>> - thispublic Polynomial<R> minus(Polynomial<R> that)
that - the polynomial being subtracted.
this - thatpublic Polynomial<R> times(Polynomial<R> that)
times in interface Ring<Polynomial<R extends Ring<R>>>that - the polynomial multiplier.
this · thatpublic Polynomial<R> compose(Polynomial<R> that)
that - the polynomial for which the return value is passed as
argument to this function.
(this o that)
FunctionException - if this function is not univariate.public <Z> Function<Z,R> compose(Function<Z,R> that)
Function
compose in class Function<R extends Ring<R>,R extends Ring<R>>that - the function for which the return value is passed as
argument to this function.
(this o that)public Polynomial<R> differentiate(Variable<R> v)
Function
differentiate in class Function<R extends Ring<R>,R extends Ring<R>>v - the variable for which the derivative is calculated.
d[this]/dvpublic Polynomial<R> integrate(Variable<R> v)
Function
integrate in class Function<R extends Ring<R>,R extends Ring<R>>v - the variable for which the integral is calculated.
S[this·dv]public Function<R,R> plus(Function<R,R> that)
Function
plus in class Function<R extends Ring<R>,R extends Ring<R>>that - the function to be added.
this + that.public Function<R,R> minus(Function<R,R> that)
Function
minus in class Function<R extends Ring<R>,R extends Ring<R>>that - the function to be subtracted.
this - that.public Function<R,R> times(Function<R,R> that)
Function
times in class Function<R extends Ring<R>,R extends Ring<R>>that - the function multiplier.
this · that.public Polynomial<R> pow(int n)
Function
pow in class Function<R extends Ring<R>,R extends Ring<R>>n - the exponent.
thisnpublic List<Variable<R>> getVariables()
Function
getVariables in class Function<R extends Ring<R>,R extends Ring<R>>public R evaluate()
Functionvariables current
values.
evaluate in class Function<R extends Ring<R>,R extends Ring<R>>public boolean equals(Object obj)
Function
equals in class Function<R extends Ring<R>,R extends Ring<R>>obj - the object to be compared with.
true if this function and the specified argument
represent the same function; false otherwise.public int hashCode()
FunctionFunction.equals(Object).
hashCode in class Function<R extends Ring<R>,R extends Ring<R>>public Text toText()
FunctiontoString except that the returned value
can be allocated from the local context space).
toText in interface RealtimetoText in class Function<R extends Ring<R>,R extends Ring<R>>public Polynomial<R> copy()
allocated
by the calling thread (possibly on the stack).
copy in interface ValueType
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||