The mathIT Library
A Java™ API for mathematics
org.mathIT.approximation

## Class Interpolation

• ```public class Interpolation
extends Object```
This class enables to generate objects from data points (x, y) such as time series and to compute interpolation polynomials from them. There are multiple data series possible, i.e., y is an array.
Version:
1.1
Author:
Andreas de Vries
• ### Constructor Summary

Constructors
Constructor and Description
```Interpolation(double[] xValues, double[][] yValues)```
Creates a new instance of Interpolation.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double[]` `getXValues()`
Returns the x-values of the data points (x, y).
`double[][]` `getYValues()`
Returns the array of y-values of the data points (x, y).
`double[]` `piecewiseLinear(double x)`
piecewise linear continuous function interpolating between the x-y values.
`double[]` `polynomial(double x)`
Returns the value at x of the polynomial interpolating through the given data points, as given by Lagrange's classical formula.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Interpolation

```public Interpolation(double[] xValues,
double[][] yValues)```
Creates a new instance of Interpolation.
Parameters:
`xValues` - the x-values of the data points (x, y)
`yValues` - an array of the y-values of the data points (x, y)
• ### Method Detail

• #### getXValues

`public double[] getXValues()`
Returns the x-values of the data points (x, y).
Returns:
the x-values of the data points
• #### getYValues

`public double[][] getYValues()`
Returns the array of y-values of the data points (x, y).
Returns:
the y-values of the data points
• #### piecewiseLinear

`public double[] piecewiseLinear(double x)`
piecewise linear continuous function interpolating between the x-y values.
Parameters:
`x` - a data point
Returns:
the y-values for each curve at x
• #### polynomial

`public double[] polynomial(double x)`
Returns the value at x of the polynomial interpolating through the given data points, as given by Lagrange's classical formula. If there are n data points, the polynomial has degree n.
Parameters:
`x` - a data point
Returns:
the y-values for each curve
Throws:
`IllegalArgumentException` - if there exist two identical x-values