Skip to content

linint_Gen

Fabian Kindermann edited this page Apr 1, 2021 · 5 revisions
function linint_Gen(x, xi, yi, istart_in)

Description:

Interpolates the (arbitrary) data pairs ({(x_i, y_i)}_{i=0}^n) with a piecewise linear function. The interpolant is evaluated at the supplied value (x).

Input arguments:

  • real*8 :: x
    The point where to evaluate the interpolating piecewise linear function.
  • real*8 :: xi(:)
    A one-dimensional array containing the nodes at which the interpolation data is supplied. Note that the data can be arbitrary, but needs to be supplied in ascending order, otherwise the subroutine does not work.
  • real*8 :: yi(:)
    A one-dimensional array containing the interpolation data at the nodes xi. This input variable needs to have the same length as xi.

Optional arguments:

  • integer :: istart_in
    If you have a good guess of a gridpoint (x_i) that is very closely located to the interpolation point x, you can supply its index (i) through this optional input variable. By doing so, you can speed up the process of interpolation significantly.

Return Value:

  • real*8 :: linint_Gen
    The value of the interpolating piecewise linear function at the point supplied in x.

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.
  • This routine is used in the following programs:
    • prog08_07.f90
Clone this wiki locally