public class RealPolynomial extends Object
Constructor and Description |
---|
RealPolynomial(double... coefficients)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
double[] |
evaluate(double... x)
Evaluates the polynomial at the specified values of the independent variable.
|
double |
evaluate(double x)
Evaluates the polynomial at the specified value of the independent variable.
|
double |
get(int index)
Gets the coefficient of the monomial of the specified order.
|
int |
getOrder()
Gets the order of the polynomial.
|
public RealPolynomial(double... coefficients)
coefficients
- The coefficients of the polynomial, starting with the highest order term
(P = coefficients[0]*x^(N) + coefficients[1]*x^(N-1) + ... + coefficients[N-1]*x + coefficients[N])
where N is the order of the polynomial.public final int getOrder()
public final double get(int index)
index
- The index of the coefficient of the monomial of the specified order.ArgumentOutOfRangeException
- Thrown when the parameter index
is less than zero or is greater
than or equal to the Order
(get
).public final double evaluate(double x)
x
- The independent variable value.public final double[] evaluate(double... x)
x
- The independent variable values.