Interpolation and Lookup Functions

In the following function, y and x are one-dimensional arrays which determine a piecewise linear function y(x). The x must be monotonic. The xp (for x -prime) can be an array of any dimensionality; the dimensions of the result will be the same as the dimensions of xp.

digitize(xp, x)   returns indices of xp values in x
interp(y, x, xp returns yp, xp interpolated into y(x)
integ(y, x, xp)   returns the integrals of y(x) from x(1) to xp

Note that integ is really an area-conserving interpolator. If the xp coincide with x, you probably want to use
  (y (zcen)*x (dif))(cum)
instead.

The on-line help documentation for interp describes how to use interp and integ with multidimensional y arrays.