SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.functions.Polynomial Class Reference

Represents a polynomial of degree \(n\) in power form. More...

Inheritance diagram for umontreal.ssj.functions.Polynomial:
umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunctionWithFirstDerivative umontreal.ssj.functions.MathFunctionWithDerivative umontreal.ssj.functions.MathFunctionWithIntegral umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunction umontreal.ssj.functionfit.PolInterp

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ Polynomial()

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\).

Parameters
coeffthe coefficients of the polynomial.
Exceptions
NullPointerExceptionif `coeff` is `null`.
IllegalArgumentExceptionif the length of `coeff` is 0.

Definition at line 50 of file Polynomial.java.

Member Function Documentation

◆ derivative() [1/2]

double umontreal.ssj.functions.Polynomial.derivative ( double x)

Computes (or estimates) the first derivative of the function at point x.

Parameters
xthe point to evaluate the derivative to.
Returns
the value of the derivative.

Implements umontreal.ssj.functions.MathFunctionWithFirstDerivative.

Definition at line 107 of file Polynomial.java.

◆ derivative() [2/2]

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).

Parameters
xthe point to evaluate the derivate to.
nthe order of the derivative.
Returns
the resulting derivative.
Exceptions
IllegalArgumentExceptionif `n` is negative or 0.

Implements umontreal.ssj.functions.MathFunctionWithDerivative.

Definition at line 111 of file Polynomial.java.

◆ derivativePolynomial()

Polynomial umontreal.ssj.functions.Polynomial.derivativePolynomial ( int n)

Returns a polynomial corresponding to the \(n\)th derivative of this polynomial.

Parameters
nthe degree of the derivative.
Returns
the derivative.

Definition at line 134 of file Polynomial.java.

◆ evaluate()

double umontreal.ssj.functions.Polynomial.evaluate ( double x)

Returns the value of the function evaluated at \(x\).

Parameters
xvalue at which the function is evaluated
Returns
function evaluated at x

Implements umontreal.ssj.functions.MathFunction.

Definition at line 100 of file Polynomial.java.

◆ getCoefficient()

double umontreal.ssj.functions.Polynomial.getCoefficient ( int i)

Returns the \(i\)th coefficient of the polynomial.

Returns
the array of coefficients.

Definition at line 81 of file Polynomial.java.

◆ getCoefficients()

double[] umontreal.ssj.functions.Polynomial.getCoefficients ( )

Returns an array containing the coefficients of the polynomial.

Returns
the array of coefficients.

Definition at line 72 of file Polynomial.java.

◆ getDegree()

int umontreal.ssj.functions.Polynomial.getDegree ( )

Returns the degree of this polynomial.

Returns
the degree of this polynomial.

Definition at line 63 of file Polynomial.java.

◆ integral()

double umontreal.ssj.functions.Polynomial.integral ( double a,
double b )

Computes (or estimates) the integral of the function over the interval \([a, b]\).

Parameters
athe starting point of the interval.
bthe ending point of the interval.
Returns
the value of the integral.

Implements umontreal.ssj.functions.MathFunctionWithIntegral.

Definition at line 154 of file Polynomial.java.

◆ integralPolynomial()

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.

Parameters
cthe constant for the integral.
Returns
the polynomial representing the integral.

Definition at line 175 of file Polynomial.java.

◆ setCoefficients()

void umontreal.ssj.functions.Polynomial.setCoefficients ( double... coeff)

Sets the array of coefficients of this polynomial to coeff.

Parameters
coeffthe new array of coefficients.
Exceptions
NullPointerExceptionif `coeff` is `null`.
IllegalArgumentExceptionif the length of `coeff` is 0.

Definition at line 92 of file Polynomial.java.


The documentation for this class was generated from the following file: