SSJ
V. 2.6.

## umontreal.iro.lecuyer.functionfit Class PolInterp

```java.lang.Object
umontreal.iro.lecuyer.functions.Polynomial
umontreal.iro.lecuyer.functionfit.PolInterp
```
All Implemented Interfaces:
Serializable, Cloneable, MathFunction, MathFunctionWithDerivative, MathFunctionWithFirstDerivative, MathFunctionWithIntegral

`public class PolInterpextends Polynomialimplements Serializable`

Represents a polynomial that interpolates through a set of points. More specifically, let (x0, y0),…,(xn, yn) be a set of points and p(x) the constructed polynomial of degree n. Then, for i = 0,…, n, p(xi) = yi.

Serialized Form

Constructor Summary
```PolInterp(double[] x, double[] y)```
Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).

Method Summary
` PolInterp` `clone()`

`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]).
` double[]` `getX()`
Returns the x coordinates of the interpolated points.
` double[]` `getY()`
Returns the y coordinates of the interpolated points.
` String` `toString()`

`static String` ```toString(double[] x, double[] y)```
Makes a string representation of a set of points.

Methods inherited from class umontreal.iro.lecuyer.functions.Polynomial
`derivative, derivative, derivativePolynomial, evaluate, getCoefficient, getCoefficients, getDegree, integral, integralPolynomial, setCoefficients`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PolInterp

```public 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.

Parameters:
`x` - the x coordinates of the points.
`y` - the y coordinates of the points.
Throws:
`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.
Method Detail

### getCoefficients

```public 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]). This polynomial has degree n and there are n+1 coefficients.

Parameters:
`x` - the x coordinates of the points.
`y` - the y coordinates of the points.
Returns:
the coefficients the interpolating polynomial.

### getX

`public double[] getX()`
Returns the x coordinates of the interpolated points.

Returns:
the x coordinates of the interpolated points.

### getY

`public double[] getY()`
Returns the y coordinates of the interpolated points.

Returns:
the y coordinates of the interpolated points.

### toString

```public static String toString(double[] x,
double[] y)```
Makes a string representation of a set of points.

Parameters:
`x` - the x coordinates of the points.
`y` - the y coordinates of the points.
Returns:
the string representing the points.

### toString

`public String toString()`
Overrides:
`toString` in class `Polynomial`

### clone

`public PolInterp clone()`
Overrides:
`clone` in class `Polynomial`

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.