|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.math.Polynomial
The Polynomial class provides the functionality for multiplying
and dividing polynomials with polynomials and monomials. Polynomials and their
derivatives can be evaluated at arbitrary points and, most of all, they can
be solved. Note that for quadratic polynomials, there is a specialized and
extra stable method in class MathUtil, which is more appropriate
for solving quadratic polynomials than using the method from the
Polynomial class, which works for arbitrary degree polynomials.
This class represents a polynomial of degree n. Coefficient[i] corresponds to the x^i factor.
| Constructor Summary | |
Polynomial(double[] coefficients)
Builds a polynomial from the specified coefficients. |
|
Polynomial(Polynomial polynomial)
Copy constructor. |
|
| Method Summary | |
void |
addPolynomial(Polynomial polynomial)
Add with another polynomial. |
void |
divideMonomial(double a)
Divide by a monomial (x - a). |
boolean |
equals(Polynomial polynomial,
double accuracy)
Checks whether this polynomial is equal to another polygon within the given accuracy for each coefficient. |
double |
eval(double x)
Evaluate the value of the polynomial at point x. |
double |
evalDerivative(double x)
Evaluate the derivative of the polynomial at point x. |
double |
get(int n)
Returns the coefficient n of the polynomial |
int |
getDegree()
Returns the degree of the polynomial |
void |
multiplyMonomial(double a)
Multiply with a monomial (x - a). |
void |
multiplyPolynomial(Polynomial polynomial)
Multiply with another polynomial. |
ArrayListDouble |
solve(double left,
double right,
double accuracy)
Finds all real roots of the polynomial. |
java.lang.String |
toString()
Returns a string representation of this object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Polynomial(double[] coefficients)
coefficients - array of coefficients that defines the polynomial.
coefficient[i] corresponds to the x^i factor.public Polynomial(Polynomial polynomial)
polynomial - the source polynomial to copy from.| Method Detail |
public final int getDegree()
public final double get(int n)
n - the index of the coefficient.
n.
public final boolean equals(Polynomial polynomial,
double accuracy)
polynomial - the Polynomial to check.accuracy - the accuracy of the comparison
public final double eval(double x)
x - the x value to evaluate the polynomial for.
public final double evalDerivative(double x)
x - the x value to evaluate the polynomial for.
public final void multiplyPolynomial(Polynomial polynomial)
polynomial - the multiplier polynomial.public final void addPolynomial(Polynomial polynomial)
polynomial - the polynomial to add.public final void multiplyMonomial(double a)
a - the addend a of the monomial.public final void divideMonomial(double a)
a - the addend a of the monomial.
public final ArrayListDouble solve(double left,
double right,
double accuracy)
xacc
interval.
left - left border of the interval to scan for solutions of the
polynomial.right - right border of the interval to scan for solutions of
the polynomial.accuracy - accuracy in x for the found solutions
public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||