|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.functions.Polynomial
public class Polynomial
Represents a polynomial of degree n in power form. Such a polynomial is of the form
Constructor Summary | |
---|---|
Polynomial(double... coeff)
Constructs a new polynomial with coefficients coeff. |
Method Summary | |
---|---|
Polynomial |
clone()
|
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 nth derivative of the function at point x. |
Polynomial |
derivativePolynomial(int n)
Returns a polynomial corresponding to the nth derivative of this polynomial. |
double |
evaluate(double x)
Returns the value of the function evaluated at x. |
double |
getCoefficient(int i)
Returns the ith 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]. |
Polynomial |
integralPolynomial(double c)
Returns a polynomial representing the integral of this polynomial. |
void |
setCoefficients(double... coeff)
Sets the array of coefficients of this polynomial to coeff. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Polynomial(double... coeff)
coeff
- the coefficients of the polynomial.
NullPointerException
- if coeff is null.
IllegalArgumentException
- if the length of coeff is 0.Method Detail |
---|
public int getDegree()
public double[] getCoefficients()
public double getCoefficient(int i)
public void setCoefficients(double... coeff)
coeff
- the new array of coefficients.
NullPointerException
- if coeff is null.
IllegalArgumentException
- if the length of coeff is 0.public double evaluate(double x)
MathFunction
evaluate
in interface MathFunction
x
- value at which the function is evaluated
public double derivative(double x)
MathFunctionWithFirstDerivative
derivative
in interface MathFunctionWithFirstDerivative
x
- the point to evaluate the derivative to.
public double derivative(double x, int n)
MathFunctionWithDerivative
evaluate
.
derivative
in interface MathFunctionWithDerivative
x
- the point to evaluate the derivate to.n
- the order of the derivative.
public Polynomial derivativePolynomial(int n)
n
- the degree of the derivative.
public double integral(double a, double b)
MathFunctionWithIntegral
integral
in interface MathFunctionWithIntegral
a
- the starting point of the interval.b
- the ending point of the interval.
public Polynomial integralPolynomial(double c)
c
- the constant for the integral.
public String toString()
toString
in class Object
public Polynomial clone()
clone
in class Object
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |