Represents a polynomial of degree \(n\) in power form. More...
Public Member Functions | |
| Polynomial (double... coeff) | |
| Constructs a new polynomial with coefficients coeff. | |
| int | getDegree () |
| Returns the degree of this polynomial. | |
| double[] | getCoefficients () |
| Returns an array containing the coefficients of the polynomial. | |
| double | getCoefficient (int i) |
| Returns the \(i\)th coefficient of the polynomial. | |
| void | setCoefficients (double... coeff) |
| Sets the array of coefficients of this polynomial to coeff. | |
| double | evaluate (double x) |
| Returns the value of the function evaluated at \(x\). | |
| double | derivative (double x) |
| Computes (or estimates) the first derivative of the function at point x. | |
| double | derivative (double x, int n) |
| Computes (or estimates) the \(n\)th derivative of the function at point x. | |
| Polynomial | derivativePolynomial (int n) |
| Returns a polynomial corresponding to the \(n\)th derivative of this polynomial. | |
| double | integral (double a, double b) |
| Computes (or estimates) the integral of the function over the interval \([a,
b]\). | |
| Polynomial | integralPolynomial (double c) |
| Returns a polynomial representing the integral of this polynomial. | |
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.
Definition at line 37 of file Polynomial.java.
| umontreal.ssj.functions.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. |
Definition at line 50 of file Polynomial.java.
| double umontreal.ssj.functions.Polynomial.derivative | ( | double | x | ) |
Computes (or estimates) the first derivative of the function at point x.
| x | the point to evaluate the derivative to. |
Implements umontreal.ssj.functions.MathFunctionWithFirstDerivative.
Definition at line 107 of file Polynomial.java.
| double umontreal.ssj.functions.Polynomial.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 umontreal.ssj.functions.MathFunctionWithDerivative.
Definition at line 111 of file Polynomial.java.
| Polynomial umontreal.ssj.functions.Polynomial.derivativePolynomial | ( | int | n | ) |
Returns a polynomial corresponding to the \(n\)th derivative of this polynomial.
| n | the degree of the derivative. |
Definition at line 134 of file Polynomial.java.
| double umontreal.ssj.functions.Polynomial.evaluate | ( | double | x | ) |
Returns the value of the function evaluated at \(x\).
| x | value at which the function is evaluated |
Implements umontreal.ssj.functions.MathFunction.
Definition at line 100 of file Polynomial.java.
| double umontreal.ssj.functions.Polynomial.getCoefficient | ( | int | i | ) |
Returns the \(i\)th coefficient of the polynomial.
Definition at line 81 of file Polynomial.java.
| double[] umontreal.ssj.functions.Polynomial.getCoefficients | ( | ) |
Returns an array containing the coefficients of the polynomial.
Definition at line 72 of file Polynomial.java.
| int umontreal.ssj.functions.Polynomial.getDegree | ( | ) |
Returns the degree of this polynomial.
Definition at line 63 of file Polynomial.java.
| double umontreal.ssj.functions.Polynomial.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 umontreal.ssj.functions.MathFunctionWithIntegral.
Definition at line 154 of file Polynomial.java.
| Polynomial umontreal.ssj.functions.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. |
Definition at line 175 of file Polynomial.java.
| void umontreal.ssj.functions.Polynomial.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. |
Definition at line 92 of file Polynomial.java.