Welcome to interpolation

Htm/Docs

xyfile.htm .docx ß linear interpolation in file, assumes evenly spaced x values.
                                    Example is 1-d barrier wave function.

Bli.htm .docßcode that finds the optimal set of points for plotting a function
                                    Example is Lennard Jones potential.
MidPointExpansion.htm .doc ßDetails the function represented by the bli points.

Findfun.htm .doc BLI is used to “find” a function for plotting
                                    Example is Lorentzian (positive definite which enables errors to be seen on log scale.

Locate.htm .doc ß finds j such that x(j)xx(j+1)

                                    Sample function is Loren.out found by FindFun.

LIFun.htm  .docßconverts x,y list (Lorentzian) into a function (linear between points)

Folders

Lagrange ß The BLI functions in the main folder are usually the best way to locate a function.  Lagrange interpolation between numerous points will usually give a far more accurate representation of the function.

splinefitting ß Splines, like wave functions, are continuous with continuous derivatives.  They are a bit more complicated and can go wild, but they can also be very accurate.

Quadratic ß The second derivatives can be used to find a function in the region of interest.

Fortran

alorent.for  ß Lorentzian function

AlinFun.for  ß linear between the points in the data file

bli.for  ßbest set of points for linear interpolation

bli2.for  ß same as above

locate.for  ßreturns jb such that x(jb)xx(jb+1)

Nlines.for  ß counts the lines in a file.

tbli.for ß tests the bli

TlinFun.for  ß tests AlinFun

TLOCATE.FOR ß tests locate

tlorent.for  ß tests the bli points for a Lorentzia

txyfilefun.for  ß tests interpolation in an evenly spaced file

xyfilefun.for  ß interpolated in a file without reading it.

C

bli.c

LOCATE.C

tbli.c

TLOCATE.C

tsize.c

Wpj

bli.wpj   ß tests the bli in FORTRAN

cbli.wpj  ß tests the bli in C

Clocate.wpj  ß tests locate in C

LinFun.wpj  ß generates a linear function for Loren.out without Lagrange overhead.

LORENT.WPJ  ß generates a bli spacing for the Lorentzian

TLOCATE.WPJ  ß tests locate in FORTRAN

tsize.wpj  ß tests linecount, fgetc, and getch in C

txyfilefun.wpj ß interpolates in an evenly spaced file  (FORTRAN)

Interpolation

1.                  In order to evaluate f(x) from this set of points, one needs to find J such that x(J) £ x £ x(J+1).  This is accomplished by the subroutines (locate.for and LOCATE.C) described in Locate.htm.

2.                  Conversion of this file into a linear function is covered in FileFun.htm. 

3.                  Once these points have been found Lagrange\LagrangeInterpolation.htm is an easy way to interpolate between these points to convert a collection of data points into a function. 

4.                  If the data does not have any glitches, or if you want to accentuate glitches in the data, spline fitting (splinefitting\ypp2.htm

) is highly recommended.

5.                  If you wish to keep the approximation local, but use the best estimate of the second derivative the quadratic method (Quadratic\Quadratic.htm) should be considered.