public abstract class Polynomial
extends java.lang.Object
implements java.io.Serializable
This is an abstract class that only declares general methods but does not hold the coefficients by themselves. Specific subclasses are used to handle exact rational coefficients or approximate real coefficients. This design is taken from the various java.awt.geom classes (Point2D, Rectangle2D ...)
The methods implemented deal mainly with the polynomials algebra (addition, multiplication ...) but the analysis aspects are also considered (value of the polynom for a given unknown, derivative).
Instances of this class are immutable.
| Modifier and Type | Class and Description |
|---|---|
static class |
Polynomial.DivisionResult
This class stores the result of the euclidian division of two polynomials.
|
static class |
Polynomial.Double
This class implements polynomials with one unknown and real
coefficients.
|
static class |
Polynomial.Rational
This class implements polynomials with one unknown and rational
coefficients.
|
| Constructor and Description |
|---|
Polynomial() |
| Modifier and Type | Method and Description |
|---|---|
Polynomial |
divide(java.math.BigInteger i)
Divide the instance by a constant.
|
Polynomial |
divide(long l)
Divide the instance by a constant.
|
Polynomial |
divide(RationalNumber r)
Divide the instance by a constant.
|
abstract int |
getDegree()
Get the polynomial degree.
|
abstract Polynomial |
getDerivative()
Get the derivative of the instance with respect to the unknown.
|
abstract boolean |
isIdentity()
Check if the instance is the identity polynomial.
|
abstract boolean |
isOne()
Check if the instance is the constant unit polynomial.
|
abstract boolean |
isZero()
Check if the instance is the null polynomial.
|
Polynomial |
multiply(java.math.BigInteger i)
Multiply the instance by a constant.
|
abstract Polynomial |
multiply(long l)
Multiply the instance by a constant.
|
abstract Polynomial |
multiply(RationalNumber r)
Multiply the instance by a constant.
|
abstract Polynomial |
negate()
Negate the instance.
|
abstract double |
valueAt(double x)
Get the value of the polynomial for a specified unknown.
|
public abstract boolean isZero()
public abstract boolean isOne()
public abstract boolean isIdentity()
public abstract int getDegree()
public abstract Polynomial negate()
public abstract Polynomial multiply(RationalNumber r)
r - constant to multiply bypublic abstract Polynomial multiply(long l)
l - constant to multiply bypublic Polynomial multiply(java.math.BigInteger i)
i - constant to multiply bypublic Polynomial divide(long l)
l - constant to multiply byjava.lang.ArithmeticException - if the constant is zeropublic Polynomial divide(RationalNumber r)
r - constant to multiply byjava.lang.ArithmeticException - if the constant is zeropublic Polynomial divide(java.math.BigInteger i)
i - constant to multiply byjava.lang.ArithmeticException - if the constant is zeropublic abstract double valueAt(double x)
x - value of the unknownpublic abstract Polynomial getDerivative()
Copyright © 2001-2007 Luc Maisonobe. All Rights Reserved.