public static class Polynomial.Rational extends Polynomial
In addition to classical algebra operations, euclidian division and remainder are handled.
Polynomial.DivisionResult, Polynomial.Double, Polynomial.Rational| Modifier and Type | Field and Description |
|---|---|
protected RationalNumber[] |
a
Coefficients array.
|
| Constructor and Description |
|---|
Rational()
Simple constructor.
|
Rational(long value)
Simple constructor.
|
Rational(long a1,
long a0)
Simple constructor.
|
Rational(long a2,
long a1,
long a0)
Simple constructor.
|
Rational(long a3,
long a2,
long a1,
long a0)
Simple constructor.
|
Rational(RationalNumber value)
Simple constructor.
|
Rational(RationalNumber[] a)
Simple constructor.
|
Rational(RationalNumber c,
int degree)
Simple constructor.
|
Rational(RationalNumber a1,
RationalNumber a0)
Simple constructor.
|
Rational(RationalNumber a2,
RationalNumber a1,
RationalNumber a0)
Simple constructor.
|
Rational(RationalNumber a3,
RationalNumber a2,
RationalNumber a1,
RationalNumber a0)
Simple constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Polynomial.Rational |
add(Polynomial.Rational p)
Add a polynomial to the instance
|
static Polynomial.DivisionResult |
euclidianDivision(Polynomial.Rational dividend,
Polynomial.Rational divisor)
Perform the euclidian division of two polynomials.
|
RationalNumber[] |
getCoefficients()
Get the coefficients of the polynomial.
|
int |
getDegree()
Get the polynomial degree.
|
java.math.BigInteger |
getDenominatorsLCM()
Get the Least Common Multiple of the coefficients denominators.
|
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(long l)
Multiply the instance by a constant.
|
Polynomial.Rational |
multiply(Polynomial.Rational p)
Multiply the instance by a polynomial.
|
Polynomial |
multiply(RationalNumber r)
Multiply the instance by a constant.
|
Polynomial |
negate()
Negate the instance.
|
Polynomial.Rational |
subtract(Polynomial.Rational 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, multiplyprotected RationalNumber[] a
public Rational()
public Rational(long value)
value - constant value of the polynomialpublic Rational(RationalNumber value)
value - constant value of the polynomialpublic Rational(long a1,
long a0)
a1 - leeding degree coefficienta0 - constant termpublic Rational(RationalNumber a1, RationalNumber a0)
a1 - leeding degree coefficienta0 - constant termpublic Rational(long a2,
long a1,
long a0)
a2 - leeding degree coefficienta1 - first degree coefficienta0 - constant termpublic Rational(RationalNumber a2, RationalNumber a1, RationalNumber a0)
a2 - leeding degree coefficienta1 - first degree coefficienta0 - constant termpublic Rational(long a3,
long a2,
long a1,
long a0)
a3 - leeding degree coefficienta2 - second degree coefficienta1 - first degree coefficienta0 - constant termpublic Rational(RationalNumber a3, RationalNumber a2, RationalNumber a1, RationalNumber a0)
a3 - leeding degree coefficienta2 - second degree coefficienta1 - first degree coefficienta0 - constant termpublic Rational(RationalNumber[] 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 Rational(RationalNumber c, int degree)
c - coefficientdegree - degree associated with the coefficientpublic boolean isZero()
isZero in class Polynomialpublic boolean isOne()
isOne in class Polynomialpublic boolean isIdentity()
isIdentity in class Polynomialpublic int getDegree()
getDegree in class Polynomialpublic RationalNumber[] getCoefficients()
public Polynomial.Rational add(Polynomial.Rational p)
p - polynomial to addpublic Polynomial.Rational subtract(Polynomial.Rational p)
p - polynomial to subtractpublic Polynomial negate()
negate in class Polynomialpublic Polynomial.Rational multiply(Polynomial.Rational 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 double valueAt(double x)
valueAt in class Polynomialx - value of the unknownpublic Polynomial getDerivative()
getDerivative in class Polynomialpublic static Polynomial.DivisionResult euclidianDivision(Polynomial.Rational dividend, Polynomial.Rational divisor)
dividend - numerator polynomialdivisor - denominator polynomialpublic java.math.BigInteger getDenominatorsLCM()
public 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.