public class PolynomialFunction2D extends java.lang.Object implements Function2D, java.io.Serializable
y = a0 + a1 * x + a2 * x^2 + ... + an *
x^n
. Instances of this class are immutable.Constructor and Description |
---|
PolynomialFunction2D(double[] coefficients)
Constructs a new polynomial function
y = a0 + a1 * x + a2 * x^2 +
... |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Tests this function for equality with an arbitrary object.
|
double[] |
getCoefficients()
Returns a copy of the coefficients array that was specified in the
constructor.
|
int |
getOrder()
Returns the order of the polynomial.
|
double |
getValue(double x)
Returns the function value.
|
int |
hashCode()
Returns a hash code for this instance.
|
public PolynomialFunction2D(double[] coefficients)
y = a0 + a1 * x + a2 * x^2 +
... + an * x^n
coefficients
- an array with the coefficients [a0, a1, ..., an]
(null
not permitted).public double[] getCoefficients()
public int getOrder()
public double getValue(double x)
getValue
in interface Function2D
x
- the x-value.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object (null
permitted).public int hashCode()
hashCode
in class java.lang.Object