public static class Polynomial.Double extends Polynomial
Polynomial.DivisionResult, Polynomial.Double, Polynomial.Rational| Modifier and Type | Field and Description |
|---|---|
protected double[] |
a
Coefficients array.
|
| Constructor and Description |
|---|
Double()
Simple constructor.
|
Double(double value)
Simple constructor.
|
Double(double[] a)
Simple constructor.
|
Double(double a1,
double a0)
Simple constructor.
|
Double(double a2,
double a1,
double a0)
Simple constructor.
|
Double(double a3,
double a2,
double a1,
double a0)
Simple constructor.
|
Double(double c,
int degree)
Simple constructor.
|
Double(long value)
Simple constructor.
|
Double(long a1,
long a0)
Simple constructor.
|
Double(long a2,
long a1,
long a0)
Simple constructor.
|
Double(long a3,
long a2,
long a1,
long a0)
Simple constructor.
|
Double(Polynomial.Rational r)
Simple constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Polynomial.Double |
add(Polynomial.Double p)
Add a polynomial to the instance
|
double[] |
getCoefficients()
Get the coefficients of the polynomial.
|
int |
getDegree()
Get the polynomial degree.
|
Polynomial |
getDerivative()
Get the derivative of the instance with respect to the unknown.
|
boolean |
isIdentity()
Check if the instance is the identity polynomial.
|
boolean |
isOne()
Check if the instance is the constant unit polynomial.
|
boolean |
isZero()
Check if the instance is the null polynomial.
|
Polynomial |
multiply(double r)
Multiply the instance by a constant.
|
Polynomial |
multiply(long l)
Multiply the instance by a constant.
|
Polynomial.Double |
multiply(Polynomial.Double p)
Multiply the instance by a polynomial.
|
Polynomial |
multiply(RationalNumber r)
Multiply the instance by a constant.
|
Polynomial |
negate()
Negate the instance.
|
Polynomial.Double |
subtract(Polynomial.Double p)
Subtract a polynomial from the instance.
|
java.lang.String |
toString()
Returns a string representation of the polynomial.
|
double |
valueAt(double x)
Get the value of the polynomial for a specified unknown.
|
divide, divide, divide, multiplypublic Double()
public Double(long value)
value - constant value of the polynomialpublic Double(double value)
value - constant value of the polynomialpublic Double(long a1,
long a0)
a1 - leeding degree coefficienta0 - constant termpublic Double(double a1,
double a0)
a1 - leeding degree coefficienta0 - constant termpublic Double(long a2,
long a1,
long a0)
a2 - leeding degree coefficienta1 - first degree coefficienta0 - constant termpublic Double(double a2,
double a1,
double a0)
a2 - leeding degree coefficienta1 - first degree coefficienta0 - constant termpublic Double(long a3,
long a2,
long a1,
long a0)
a3 - leeding degree coefficienta2 - second degree coefficienta1 - first degree coefficienta0 - constant termpublic Double(double a3,
double a2,
double a1,
double a0)
a3 - leeding degree coefficienta2 - second degree coefficienta1 - first degree coefficienta0 - constant termpublic Double(double[] a)
a - coefficients array, the a[0] array element is the
constant term while the a[a.length-1] element is the leeding
degree coefficient. The array is copied in a new array, so it
can be changed once the constructor as returned.public Double(double c,
int degree)
c - coefficientdegree - degree associated with the coefficientpublic Double(Polynomial.Rational r)
Polynomial.Double from a
Polynomial.Rationalr - a rational polynomialpublic boolean isZero()
isZero in class Polynomialpublic boolean isOne()
isOne in class Polynomialpublic boolean isIdentity()
isIdentity in class Polynomialpublic int getDegree()
getDegree in class Polynomialpublic double[] getCoefficients()
public Polynomial.Double add(Polynomial.Double p)
p - polynomial to addpublic Polynomial.Double subtract(Polynomial.Double p)
p - polynomial to subtractpublic Polynomial negate()
negate in class Polynomialpublic Polynomial.Double multiply(Polynomial.Double p)
p - polynomial to multiply bypublic Polynomial multiply(long l)
multiply in class Polynomiall - constant to multiply bypublic Polynomial multiply(RationalNumber r)
multiply in class Polynomialr - constant to multiply bypublic Polynomial multiply(double r)
r - constant to multiply bypublic double valueAt(double x)
valueAt in class Polynomialx - value of the unknownpublic Polynomial getDerivative()
getDerivative in class Polynomialpublic java.lang.String toString()
The representation is user oriented. Terms are displayed lowest
degrees first. The multiplications signs, coefficients equals to
one and null terms are not displayed (except if the polynomial is 0,
in which case the 0 constant term is displayed). Addition of terms
with negative coefficients are replaced by subtraction of terms
with positive coefficients except for the first displayed term
(i.e. we display -3 for a constant negative polynomial,
but 1 - 3 x + x^2 if the negative coefficient is not
the first one displayed).
toString in class java.lang.ObjectCopyright © 2001-2007 Luc Maisonobe. All Rights Reserved.