| org.jscience.mathematics.function.Polynomial
Polynomial | public class Polynomial extends Function implements Ring<Polynomial<R>>(Code) | | This class represents a mathematical expression involving a sum of powers
in one or more
Variable variables multiplied by
coefficients (such as x² + x·y + 3y² ).
Polynomials are characterized by the type of variable they operate
upon. For example:[code]
Variable> varX = new Variable.Local>("x");
Polynomial> x = Polynomial.valueOf(Amount.valueOf(1, SI.METER), varX);
and
Variable varX = new Variable.Local("x");
Polynomial x = Polynomial.valueOf(Complex.ONE, varX);[/code]
are two different polynomials, the first one operates on physical
org.jscience.physics.amount.Amount measures ,
whereas the second operates on
org.jscience.mathematics.number.Complex complex numbers.
Terms (others than
Term.ONE ONE ) having zero (additive identity)
for coefficient are automatically removed.
author: Jean-Marie Dautelle version: 3.1, April 1, 2006 |
Constructor Summary | |
| Polynomial() Default constructor. |
Method Summary | |
public Polynomial<R> | compose(Polynomial<R> that) Returns the composition of this polynomial with the one specified.
Parameters: that - the polynomial for which the return value is passed asargument to this function. | public Function<Z, R> | compose(Function<Z, R> that) | public Polynomial<R> | copy() Returns a copy of this polynomial
javolution.context.AllocatorContext allocated
by the calling thread (possibly on the stack). | public Polynomial<R> | differentiate(Variable<R> v) | public boolean | equals(Object obj) | public R | evaluate() | final public R | getCoefficient(Term term) Returns the coefficient for the specified term.
Parameters: term - the term for which the coefficient is returned. | public int | getOrder(Variable<R> v) Returns the order of this polynomial for the specified variable. | public Set<Term> | getTerms() Returns the terms of this polynomial. | public List<Variable<R>> | getVariables() | public int | hashCode() | public Polynomial<R> | integrate(Variable<R> v) | public Polynomial<R> | minus(Polynomial<R> that) Returns the difference of two polynomials.
Parameters: that - the polynomial being subtracted. | public Function<R, R> | minus(Function<R, R> that) | public Polynomial<R> | opposite() Returns the opposite of this polynomial. | public Polynomial<R> | plus(R constantValue) Returns the sum of this polynomial with a constant polynomial
having the specified value (convenience method).
Parameters: constantValue - the value of the constant polynomial to add. | public Polynomial<R> | plus(Polynomial<R> that) Returns the sum of two polynomials.
Parameters: that - the polynomial being added. | public Function<R, R> | plus(Function<R, R> that) | public Polynomial<R> | pow(int n) | public Polynomial<R> | times(R constantValue) Returns the product of this polynomial with a constant polynomial
having the specified value (convenience method).
Parameters: constantValue - the value of the constant polynomial to multiply. | public Polynomial<R> | times(Polynomial<R> that) Returns the product of two polynomials.
Parameters: that - the polynomial multiplier. | public Function<R, R> | times(Function<R, R> that) | public Text | toText() | public static Polynomial<R> | valueOf(R coefficient, Variable<R> variable) Returns an univariate polynomial of degree one with the specified
coefficient multiplier.
Parameters: coefficient - the coefficient for the variable of degree 1. | public static Polynomial<R> | valueOf(R coefficient, Term term) Returns a polynomial corresponding to the specified
Term term with the specified coefficient multiplier.
Parameters: coefficient - the coefficient multiplier. |
_termToCoef | final FastMap<Term, R> _termToCoef(Code) | | Holds the terms to coefficients mapping
(never empty, holds Term.ONE when constant)
|
Polynomial | Polynomial()(Code) | | Default constructor.
|
compose | public Polynomial<R> compose(Polynomial<R> that)(Code) | | Returns the composition of this polynomial with the one specified.
Parameters: that - the polynomial for which the return value is passed asargument to this function. the polynomial (this o that) throws: FunctionException - if this function is not univariate. |
copy | public Polynomial<R> copy()(Code) | | Returns a copy of this polynomial
javolution.context.AllocatorContext allocated
by the calling thread (possibly on the stack).
an identical and independant copy of this polynomial. |
evaluate | public R evaluate()(Code) | | |
getCoefficient | final public R getCoefficient(Term term)(Code) | | Returns the coefficient for the specified term.
Parameters: term - the term for which the coefficient is returned. the coefficient for the specified term or null if this polynomial does not contain the specified term. |
getOrder | public int getOrder(Variable<R> v)(Code) | | Returns the order of this polynomial for the specified variable.
the polynomial order relative to the specified variable. |
getTerms | public Set<Term> getTerms()(Code) | | Returns the terms of this polynomial.
this polynomial's terms. |
hashCode | public int hashCode()(Code) | | |
minus | public Polynomial<R> minus(Polynomial<R> that)(Code) | | Returns the difference of two polynomials.
Parameters: that - the polynomial being subtracted. this - that |
opposite | public Polynomial<R> opposite()(Code) | | Returns the opposite of this polynomial.
- this |
plus | public Polynomial<R> plus(R constantValue)(Code) | | Returns the sum of this polynomial with a constant polynomial
having the specified value (convenience method).
Parameters: constantValue - the value of the constant polynomial to add. this + Constant.valueOf(constantValue) |
plus | public Polynomial<R> plus(Polynomial<R> that)(Code) | | Returns the sum of two polynomials.
Parameters: that - the polynomial being added. this + that |
times | public Polynomial<R> times(R constantValue)(Code) | | Returns the product of this polynomial with a constant polynomial
having the specified value (convenience method).
Parameters: constantValue - the value of the constant polynomial to multiply. this · Constant.valueOf(constantValue) |
times | public Polynomial<R> times(Polynomial<R> that)(Code) | | Returns the product of two polynomials.
Parameters: that - the polynomial multiplier. this · that |
toText | public Text toText()(Code) | | |
valueOf | public static Polynomial<R> valueOf(R coefficient, Variable<R> variable)(Code) | | Returns an univariate polynomial of degree one with the specified
coefficient multiplier.
Parameters: coefficient - the coefficient for the variable of degree 1. Parameters: variable - the variable for this polynomial. valueOf(coefficient, Term.valueOf(variable, 1)) |
valueOf | public static Polynomial<R> valueOf(R coefficient, Term term)(Code) | | Returns a polynomial corresponding to the specified
Term term with the specified coefficient multiplier.
Parameters: coefficient - the coefficient multiplier. Parameters: term - the term multiplicand. coefficient * term |
|
|