SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a polynomial that interpolates through a set of points. More...
Public Member Functions | |
PolInterp (double[] x, double[] y) | |
Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]) . More... | |
double [] | getX () |
Returns the \(x\) coordinates of the interpolated points. More... | |
double [] | getY () |
Returns the \(y\) coordinates of the interpolated points. More... | |
String | toString () |
Calls toString(double[], double[]) with the associated points. More... | |
PolInterp | clone () |
Public Member Functions inherited from Polynomial | |
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 () |
Static Public Member Functions | |
static double [] | getCoefficients (double[] x, double[] y) |
Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]) . More... | |
static String | toString (double[] x, double[] y) |
Makes a string representation of a set of points. More... | |
Represents a polynomial that interpolates through a set of points.
More specifically, let \((x_0,y_0), …, (x_n, y_n)\) be a set of points and \(p(x)\) the constructed polynomial of degree \(n\). Then, for \(i=0,…,n\), \(p(x_i)=y_i\).
PolInterp | ( | double [] | x, |
double [] | y | ||
) |
Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n])
.
This constructs a polynomial of degree n
from n+1
points.
x | the \(x\) coordinates of the points. |
y | the \(y\) coordinates of the points. |
NullPointerException | if x or y are null . |
IllegalArgumentException | if the lengths of x and y are different, or if less than two points are specified. |
|
static |
Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n])
.
This polynomial has degree n
and there are n+1
coefficients.
x | the \(x\) coordinates of the points. |
y | the \(y\) coordinates of the points. |
double [] getX | ( | ) |
Returns the \(x\) coordinates of the interpolated points.
double [] getY | ( | ) |
Returns the \(y\) coordinates of the interpolated points.
|
static |
Makes a string representation of a set of points.
x | the \(x\) coordinates of the points. |
y | the \(y\) coordinates of the points. |
String toString | ( | ) |
Calls toString(double[], double[]) with the associated points.