public class UnivariateRealPolynomial
extends java.lang.Object
JSci
mathematical/science package.Constructor and Description |
---|
UnivariateRealPolynomial()
Creates an empty polynomial object, the zero polynomial.
|
UnivariateRealPolynomial(double[] arrCoef)
Creates and initializes a polynomial to the specified coefficients.
|
Modifier and Type | Method and Description |
---|---|
double |
evaluateAt(double dblVal)
Evaluate the polynomial for the specifed value of the indeterminate.
|
double |
evaluateDerivativeAt(double dblVal)
Evaluate derivative of the polynomial for the specifed value of the indeterminate.
|
double |
getCoef(int iOrder)
Get the specified coefficient value.
|
double[] |
getCoefs()
Return the entire array of polynomial coefficients.
|
int |
getDegree()
Return the degree of the polynomial.
|
static void |
main(java.lang.String[] args)
Testing driver
|
UnivariateRealPolynomial |
plus(UnivariateRealPolynomial polyAddend)
Nondestructively add two polynomials.
|
void |
setCoefArray(double[] arrCoef)
Set the entire coefficient array.
|
UnivariateRealPolynomial |
times(UnivariateRealPolynomial polyFac)
Nondestructive multiply two polynomials.
|
java.lang.String |
toString()
Construct and return a textual representation of the contents of this
polynomial as a
String object. |
public UnivariateRealPolynomial()
public UnivariateRealPolynomial(double[] arrCoef)
iOrder
- public void setCoefArray(double[] arrCoef)
arrCoef
- double array of coefficients.public int getDegree()
public double getCoef(int iOrder)
iOrder
specifies order of the indeterminate. For example,
calling getCoef(2)
would return the coefficient for the
intdeterminate of second order.
If the value of iOrder
is larger than the size of the
coefficient array then the coefficient is assumed to have value zero.iOrder
- order of the indeterminatepublic double[] getCoefs()
public double evaluateAt(double dblVal)
dblVal
- indeterminate value to evaluate the polynomialpublic double evaluateDerivativeAt(double dblVal)
dblVal
- indeterminate value to evaluate the polynomialpublic UnivariateRealPolynomial plus(UnivariateRealPolynomial polyAddend)
polyAddend
- polynomial to be added to thispublic UnivariateRealPolynomial times(UnivariateRealPolynomial polyFac)
polyFac
- polynomial to be multiplied by thispublic java.lang.String toString()
String
object.toString
in class java.lang.Object
Object.toString()
public static void main(java.lang.String[] args)