|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.analysis.function.rn2r1.UnivariateRealFunction
com.numericalmethod.suanshu.analysis.function.polynomial.Polynomial
public class Polynomial
Polynomial is a UnivariateRealFunction that represents a finite length expression constructed from variables and constants,
using the operations of addition, subtraction, multiplication, and constant non-negative whole number exponents.
Specifically, it has the form
anxn + an-1xn-1 + ... + a1x1 + a0
Ring.
This implementation
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function |
|---|
Function.EvaluationException |
| Field Summary | |
|---|---|
int |
degree
the degree of this polynomial It is equal to the largest exponent of the variable. |
static Polynomial |
ONE
a polynomial representing 1 |
static Polynomial |
ZERO
a polynomial representing 0 |
| Constructor Summary | |
|---|---|
Polynomial(double... coefficients)
Construct a polynomial from an array of coefficients. |
|
| Method Summary | |
|---|---|
Polynomial |
add(Polynomial that)
+ : G × G → G |
double |
coefficient(int i)
Get the coefficient of xn-i, namely, an-i. |
double[] |
coefficients()
Get a copy of the coefficients. |
boolean |
equals(java.lang.Object obj)
|
Complex |
evaluate(Complex z)
Evaluate this polynomial for a Complex number input. |
double |
evaluate(double x)
Evaluate this polynomial for a real number, i.e., double input. |
Complex |
evaluate(java.lang.Number x)
Evaluate this polynomial for a Number input. |
int |
hashCode()
|
Polynomial |
minus(Polynomial that)
- : G × G → G
- is not in the definition of of an additive group but can be deduced. |
Polynomial |
multiply(Polynomial that)
· : G × G → G |
Polynomial |
normalize()
Normalize this polynomial so that the leading coefficient is 1. |
Polynomial |
ONE()
The multiplicative element 1 in the group such that for any elements a in the group,
the equation
1 × a = a × 1 = a
holds. |
Polynomial |
opposite()
For each a in G, there exists an element b in G such that a + b = b + a = 0
That is, it is the object such as
this.add(this.opposite()) == this.ZERO |
Polynomial |
scaled(double scalar)
|
Polynomial |
scaled(Real scalar)
Deprecated. Not supported yet. |
java.lang.String |
toString()
|
Polynomial |
ZERO()
The additive element 0 in the group, such that for all elements a in the group,
the equation 0 + a = a + 0 = a holds. |
| Methods inherited from class com.numericalmethod.suanshu.analysis.function.rn2r1.UnivariateRealFunction |
|---|
dimension4Domain, dimension4Range, evaluate |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Polynomial ZERO
0
public static final Polynomial ONE
1
public final int degree
It is equal to the largest exponent of the variable.
For example,
x4 + 1has a degree of 4.
| Constructor Detail |
|---|
public Polynomial(double... coefficients)
The degree of the polynomial is n.
For example,
new Polynomial(1, -2, 3, 2)
will create an instance of Polynomial representing
x3 - 2x2 + 3x + 2
coefficients - the polynomial coefficients in (double)| Method Detail |
|---|
public double[] coefficients()
Given a polynomial of degree n, the i-th element correspond to the coefficient of xn-i. The 0-th entry corresponds to the xn term, which cannot be zero; The n-th entry corresponds to the constant term.
public double coefficient(int i)
i - indicates the i-th coefficient in this polynomial
coefficients()public Polynomial normalize()
public Complex evaluate(java.lang.Number x)
Number input.
x - the argument
p(x), the result in Complexpublic double evaluate(double x)
double input.
evaluate in class UnivariateRealFunctionx - the argument
p(x), the result in Doublepublic Complex evaluate(Complex z)
Complex number input.
z - the argument
p(z), the result in Complexpublic Polynomial add(Polynomial that)
AbelianGroup+ : G × G → G
add in interface AbelianGroup<Polynomial>that - the object to be added
this + thatpublic Polynomial minus(Polynomial that)
AbelianGroup- : G × G → G
- is not in the definition of of an additive group but can be deduced.
This function is provided for convenience purpose.
It is equivalent to
this.add(that.opposite())
minus in interface AbelianGroup<Polynomial>that - the object to be subtracted (subtrahend)
this - thatpublic Polynomial multiply(Polynomial that)
Monoid· : G × G → G
multiply in interface Monoid<Polynomial>that - the multiplicand
this × that@Deprecated public Polynomial scaled(Real scalar)
VectorSpace* : F × V → V
The result of applying this function to scalar, c, in F and v in V is denoted cv.
scaled in interface VectorSpace<Polynomial,Real>scalar - a multiplier
scalar * thispublic Polynomial scaled(double scalar)
public Polynomial opposite()
AbelianGroupa + b = b + a = 0
That is, it is the object such as
this.add(this.opposite()) == this.ZERO
opposite in interface AbelianGroup<Polynomial>-thispublic Polynomial ZERO()
AbelianGroupa in the group,
the equation 0 + a = a + 0 = a holds.
ZERO in interface AbelianGroup<Polynomial>0public Polynomial ONE()
Monoida in the group,
the equation
1 × a = a × 1 = a
holds.
ONE in interface Monoid<Polynomial>1public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||