Skip to content
Fabian Kindermann edited this page Apr 2, 2021 · 12 revisions
function spline(x, yi, left, right, growth)

Description:

This function interpolates the data that is located on either an equidistant grid of nodes or one with nodes of growing distance , see grid_Cons_Equi or grid_Cons_Grow. It therefore uses a piecewise third order polynomial or spline function. Note that this function can interpolate data from one up to seven dimensions. If interpolation data is supplied for more than one dimension, it must be located on a rectilinear grid that is created from the Tensor product of equidistant or growing nodes along each dimension. More specifically, for interpolation in dimension, the interpolation data is

Along each dimension , the points form an equidistant or growing grid. Click on the respective number of dimensions you want to use for interpolation in order to get a description of the input variables needed for this function.

One-dimensional spline interpolation

Input arguments:

  • real*8 :: x    or    real*8 :: x(:)
    The point(s) where to evaluate the interpolating spline. This can be either a scalar or a one-dimensional array of arbitrary size. In the latter case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:)
    A one-dimensional array containing the interpolation data at the (equidistant or growing) nodes . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left
    The left interval endpoint of the (equidistant or growing) grid .
  • real*8 :: right
    The right interval endpoint of the (equidistant or growing) grid .

Optional arguments:

  • real*8 :: growth
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a scalar and a one-dimensional array if x is an array.

Two-dimensional spline interpolation

Input arguments:

  • real*8 :: x(2)    or    real*8 :: x(:, 2)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 2, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 2. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :)
    A two-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(2)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(2)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(2)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

Three-dimensional spline interpolation

Input arguments:

  • real*8 :: x(3)    or    real*8 :: x(:, 3)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 3, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 3. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :, :)
    A three-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(3)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(3)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(3)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

Four-dimensional spline interpolation

Input arguments:

  • real*8 :: x(4)    or    real*8 :: x(:, 4)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 4, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 4. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :, :, :)
    A four-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(4)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(4)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(4)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

Five-dimensional spline interpolation

Input arguments:

  • real*8 :: x(5)    or    real*8 :: x(:, 5)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 5, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 5. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :, :, :, :)
    A five-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(5)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(5)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(5)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

Six-dimensional spline interpolation

Input arguments:

  • real*8 :: x(6)    or    real*8 :: x(:, 6)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 6, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 6. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :, :, :, :, :)
    A six-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(6)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(6)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(6)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

Seven-dimensional spline interpolation

Input arguments:

  • real*8 :: x(7)    or    real*8 :: x(:, 7)
    The point(s) where to evaluate the interpolating spline. This can be either a one-dimensional array of length 7, in which case only one point (with coordinates along each of the interpolation dimensions) is supplied. Alternatively, you can supply a two-dimensional array, where the second dimension is again of length 7. In this case, the spline is evaluated at each point supplied in the array x.
  • real*8 :: yi(:, :, :, :, :, :, :)
    A seven-dimensional array containing the interpolation data at the (equidistant or growing) node combinations . Note that the nodes themselves need not be supplied, but they are rather defined by the input variables left, right and growth.
  • real*8 :: left(7)
    The left interval endpoint of the (equidistant or growing) grid in each interpolation dimension.
  • real*8 :: right(7)
    The right interval endpoint of the (equidistant or growing) grid in each interpolation dimension.

Optional arguments:

  • real*8 :: growth(7)
    If the gridpoints for which the interpolation data are supplied have a growing distance, you can supply the growth rate for each dimension through this optional variable. If nothing is passed to the function, it will assume that the interpolation nodes are equidistant.

Return Value:

  • real*8 :: spline    or    real*8 :: spline(:)
    The value of the interpolating spline function at the point(s) supplied in x. This is a scalar if x is a one-dimensional array (i.e. it only represents one point) and a one-dimensional array if x is a two-dimensional array.

References

  • For further reading refer to:
    • Süli, E. & Mayers, D. F. (2003). An Introduction to Numerical Analysis. Cambridge: Cambridge University Press.
    • Powell, M.J.D. (1996). Approximation Theory and Methods. Cambridge: Cambridge University Press.
    • Habermann, C. & Kindermann, F. (2007). Multidimensional spline interpolation: Theory and applications. Computational Economics, 30(2), 153-169.
Clone this wiki locally