# Module Scientific.Functions.Interpolation

## Class InterpolatingFunction: Function defined by values on a grid using interpolation

An interpolating function of n variables with m-dimensional values is defined by an (n+m)-dimensional array of values and n one-dimensional arrays that define the variables values corresponding to the grid points. The grid does not have to be equidistant.

Constructor: InterpolatingFunction(axes, values, default=None)

axes

  a sequence of one-dimensional arrays, one for each variable, specifying the values of the variables at the grid points

values

  an array containing the function values on the grid

default

  the value of the function outside the grid. A value of `None` means that the function is undefined outside the grid and that any attempt to evaluate it there yields an exception.

Evaluation: `function(x1, x2, ...)` yields the function value obtained by linear interpolation.

Indexing: all array indexing operations except for the NexAxis operator are supported.

Methods:

- selectInterval(first, last, variable=`0`)

  Returns a new InterpolatingFunction whose grid is restricted to the interval from first to last along the variable whose number is variable.

- derivative(variable=`0`)

  Returns a new InterpolatingFunction describing the derivative with respect to variable (an integer).

- integral(variable=`0`)

  Returns a new InterpolatingFunction describing the integral with respect to variable (an integer). The integration constant is defined in such a way that the value of the integral at the first grid point along variable is zero.

- definiteIntegral(variable=`0`)

  Returns a new InterpolatingFunction describing the definite integral with respect to variable (an integer). The integration constant is defined in such a way that the value of the integral at the first grid point along variable is zero. In the case of a function of one variable, the definite integral is a number.

- fitPolynomial(order)

  Returns a polynomial of order with parameters obtained from a least-squares fit to the grid values.

## Class NetCDFInterpolatingFunction: Function defined by values on a grid in a netCDF file

A subclass of InterpolatingFunction.

Constructor: NetCDFInterpolatingFunction(filename, axesnames, variablename, default=None)

filename

  the name of the netCDF file

axesnames

  the names of the netCDF variables that contain the axes information

variablename

  the name of the netCDF variable that contains the data values

default

  the value of the function outside the grid. A value of `None` means that the function is undefined outside the grid and that any attempt to evaluate it there yields an exception.

Evaluation: `function(x1, x2, ...)` yields the function value obtained by linear interpolation.