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]). | |
| double[] | getX () |
| Returns the \(x\) coordinates of the interpolated points. | |
| double[] | getY () |
| Returns the \(y\) coordinates of the interpolated points. | |
| String | toString () |
Calls toString(double[], double[]) with the associated points. | |
| Public Member Functions inherited from umontreal.ssj.functions.Polynomial | |
| 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. | |
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]). | |
| static String | toString (double[] x, double[] y) |
| Makes a string representation of a set of points. | |
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\).
<div class="SSJ-bigskip"></div>
Definition at line 44 of file PolInterp.java.
| umontreal.ssj.functionfit.PolInterp.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. |
Definition at line 62 of file PolInterp.java.
|
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. |
Definition at line 77 of file PolInterp.java.
| double[] umontreal.ssj.functionfit.PolInterp.getX | ( | ) |
Returns the \(x\) coordinates of the interpolated points.
Definition at line 101 of file PolInterp.java.
| double[] umontreal.ssj.functionfit.PolInterp.getY | ( | ) |
Returns the \(y\) coordinates of the interpolated points.
Definition at line 110 of file PolInterp.java.
| String umontreal.ssj.functionfit.PolInterp.toString | ( | ) |
Calls toString(double[], double[]) with the associated points.
Reimplemented from umontreal.ssj.functions.Polynomial.
Definition at line 140 of file PolInterp.java.
|
static |
Makes a string representation of a set of points.
| x | the \(x\) coordinates of the points. |
| y | the \(y\) coordinates of the points. |
Definition at line 121 of file PolInterp.java.