SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a polynomial of degree \(n\) in power form. More...
Public Member Functions | |
Polynomial (double... coeff) | |
Constructs a new polynomial with coefficients coeff . More... | |
int | getDegree () |
Returns the degree of this polynomial. More... | |
double [] | getCoefficients () |
Returns an array containing the coefficients of the polynomial. More... | |
double | getCoefficient (int i) |
Returns the \(i\)th coefficient of the polynomial. More... | |
void | setCoefficients (double... coeff) |
Sets the array of coefficients of this polynomial to coeff . More... | |
double | evaluate (double x) |
Returns the value of the function evaluated at \(x\). More... | |
double | derivative (double x) |
Computes (or estimates) the first derivative of the function at point x . More... | |
double | derivative (double x, int n) |
Computes (or estimates) the \(n\)th derivative of the function at point x . More... | |
Polynomial | derivativePolynomial (int n) |
Returns a polynomial corresponding to the \(n\)th derivative of this polynomial. More... | |
double | integral (double a, double b) |
Computes (or estimates) the integral of the function over the interval \([a, b]\). More... | |
Polynomial | integralPolynomial (double c) |
Returns a polynomial representing the integral of this polynomial. More... | |
String | toString () |
Polynomial | clone () |
Represents a polynomial of degree \(n\) in power form.
Such a polynomial is of the form
\[ p(x) = c_0 + c_1x + \cdots+ c_nx^n, \]
where \(c_0, …, c_n\) are the coefficients of the polynomial.
Polynomial | ( | double... | coeff | ) |
Constructs a new polynomial with coefficients coeff
.
The value of coeff[i]
in this array corresponds to \(c_i\).
coeff | the coefficients of the polynomial. |
NullPointerException | if coeff is null . |
IllegalArgumentException | if the length of coeff is 0. |
double derivative | ( | double | x | ) |
Computes (or estimates) the first derivative of the function at point x
.
x | the point to evaluate the derivative to. |
Implements MathFunctionWithFirstDerivative.
double derivative | ( | double | x, |
int | n | ||
) |
Computes (or estimates) the \(n\)th derivative of the function at point x
.
For \(n=0\), this returns the result of umontreal.ssj.functions.MathFunction.evaluate(double).
x | the point to evaluate the derivate to. |
n | the order of the derivative. |
IllegalArgumentException | if n is negative or 0. |
Implements MathFunctionWithDerivative.
Polynomial derivativePolynomial | ( | int | n | ) |
Returns a polynomial corresponding to the \(n\)th derivative of this polynomial.
n | the degree of the derivative. |
double evaluate | ( | double | x | ) |
Returns the value of the function evaluated at \(x\).
x | value at which the function is evaluated |
x
Implements MathFunction.
double getCoefficient | ( | int | i | ) |
Returns the \(i\)th coefficient of the polynomial.
double [] getCoefficients | ( | ) |
Returns an array containing the coefficients of the polynomial.
int getDegree | ( | ) |
Returns the degree of this polynomial.
double integral | ( | double | a, |
double | b | ||
) |
Computes (or estimates) the integral of the function over the interval \([a, b]\).
a | the starting point of the interval. |
b | the ending point of the interval. |
Implements MathFunctionWithIntegral.
Polynomial integralPolynomial | ( | double | c | ) |
Returns a polynomial representing the integral of this polynomial.
This integral is of the form
\[ \int p(x)dx = c + c_0x + \frac{c_1 x^2}{2} + \cdots+ \frac{c_n x^{n+1}}{n+1}, \]
where \(c\) is a user-defined constant.
c | the constant for the integral. |
void setCoefficients | ( | double... | coeff | ) |
Sets the array of coefficients of this polynomial to coeff
.
coeff | the new array of coefficients. |
NullPointerException | if coeff is null . |
IllegalArgumentException | if the length of coeff is 0. |