>  Docs Center  >  Libraries  >  ASTROLIB  >  HERMITE
Libraries

HERMITE

HERMITE

Name


      HERMITE

Purpose


      To compute Hermite spline interpolation of a tabulated function.

Explanation


      Hermite interpolation computes the cubic polynomial that agrees with
      the tabulated function and its derivative at the two nearest
      tabulated points. It may be preferable to Lagrangian interpolation
      (QUADTERP) when either (1) the first derivatives are known, or (2)
      one desires continuity of the first derivative of the interpolated
      values. HERMITE() will numerically compute the necessary
      derivatives, if they are not supplied.
     

Calling Sequence


      F = HERMITE( XX, FF, X, [ FDERIV = ])

Input Parameters


      XX - Vector giving tabulated X values of function to be interpolated
              Must be either monotonic increasing or decreasing
      FF - Tabuluated values of function, same number of elements as X
      X - Scalar or vector giving the X values at which to interpolate

Optional Input Keyword


      FDERIV - function derivative values computed at XX. If not supplied,
              then HERMITE() will compute the derivatives numerically.
              The FDERIV keyword is useful either when (1) the derivative
              values are (somehow) known to better accuracy than can be
              computed numerically, or (2) when HERMITE() is called repeatedly
              with the same tabulated function, so that the derivatives
              need be computed only once.

Output Parameter


      F - Interpolated values of function, same number of points as X

Example


      Interpolate the function 1/x at x = 0.45 using tabulated values
      with a spacing of 0.1
      IDL> x = findgen(20)*0.1 + 0.1
      IDL> y = 1/x
      IDL> print,hermite(x,y,0.45)
              This gives 2.2188 compared to the true value 1/0.45 = 2.2222
      IDL> yprime = -1/x^2 ;But in this case we know the first derivatives
      IDL> print,hermite(x,y,0.45,fderiv = yprime)
            == 2.2219 ;and so can get a more accurate interpolation

Notes


      The algorithm here is based on the FORTRAN code discussed by
      Hill, G. 1982, Publ Dom. Astrophys. Obs., 16, 67. The original
      FORTRAN source is U.S. Airforce. Surveys in Geophysics No 272.
      HERMITE() will return an error if one tries to interpolate any values
      outside of the range of the input table XX

Procedures Called


      None

Revision History


      Written, B. Dorman (GSFC) Oct 1993, revised April 1996
      Added FDERIV keyword, W. Landsman (HSTX) April 1996
      Test for out of range values W. Landsman (HSTX) May 1996
      Converted to IDL V5.0 W. Landsman September 1997
      Use VALUE_LOCATE instead of TABINV W. Landsman February 2001



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us