TEST_APPROX
Test Functions for
Approximation and Interpolation
TEST_APPROX is a FORTRAN90 library
which can test approximation and interpolation software.
TEST_APPROX contains a number of functions Y=F(X) that can
be evaluated at any point, and some vectors of data (X(1:N),Y(1:N))
for which no underlying functional relationship is given.
When a function is supplied, then a data vector of any dimension
can be generated for a test.
The task of interpolation software is to find, from some given
class of functions, the function G(X) which exactly matches the
known data values. That is, G(X(1:N)) = Y(1:N).
The task of approximation software is to find, from some given
class of functions, the function H(X) for which some approximation
error is minimized. There are many forms of error measurement.
For instance, the error might simply be the sum of the differences
of the function and the data at the data abscissas:
l1(X) = sum ( 1 <= I <= N ) abs ( H(X(I)) - Y(I) )
or the square root of the sum of squares
l2(X) = sqrt ( sum ( 1 <= I <= N ) ( H(X(I)) - Y(I) )**2 )
or the maximum pointwise error:
l_inf(X) = max ( abs ( H(X(I)) - Y(I) ) )
In cases where a functional form is given, the error might be
measured in terms of the integral of the absolute value of the
difference over some interval:
L1(X,A,B) = integral ( A <= X <= B ) abs ( H(X) - F(X) ) dx
and so on.
Related Data and Programs:
DIVDIF
is a FORTRAN90 library of routines which
includes many routines to construct and evaluate divided difference
interpolants.
PPPACK
is a FORTRAN90 library of routines which implements
Carl de Boor's piecewise polynomial functions,
including, particularly, cubic splines.
PS_WRITE
is a FORTRAN90 library of routines for creating PostScript images.
A number of routines were "borrowed" from this library
for use by the test program.
SPLINE
is a FORTRAN90 library of routines which
includes many routines to construct and evaluate spline
interpolants and approximants.
Reference:
-
Samuel Conte, Carl deBoor,
Elementary Numerical Analysis,
Second Edition,
McGraw Hill, 1972,
ISBN: 07-012446-4,
LC: QA297.C65.
-
Carl deBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.
-
Max Waldmeier,
The Sunspot-Activity in the Years 1610-1960,
Shulthess, 1961,
LC: QB525.W34.
Source Code:
Examples and Tests:
A few of the tests create graphics output files:
List of Routines:
-
CH_CAP capitalizes a single character.
-
GET_PROB_NUM returns the number of test problems.
-
I4_SWAP swaps two I4's.
-
P00_DAT returns the data vector for problems of data vector type.
-
P00_FUN evaluates the function for any problem.
-
P00_LIM returns the limits of the approximation interval for any problem.
-
P00_NDATA returns the dimension of the data vector for any problem.
-
P00_PERIOD returns the periodicity of any problem.
-
P00_STORY prints the "story" for any problem.
-
P00_TITLE returns the title of any problem.
-
P00_TYPE returns the type of any problem.
-
P01_FUN evaluates the function for problem 1.
-
P01_LIM returns the limits of the approximation interval for problem 1.
-
P01_STORY prints the "story" for problem 1.
-
P01_TITLE returns the title of problem 1.
-
P01_TYPE returns the type of problem 1.
-
P02_FUN evaluates the function for problem 2.
-
P02_LIM returns the limits of the approximation interval for problem 2.
-
P02_STORY prints the "story" for problem 2.
-
P02_TITLE returns the title of problem 2.
-
P02_TYPE returns the type of problem 2.
-
P03_DAT returns the data vector for problem 3.
-
P03_LIM returns the limits of the approximation interval for problem 3.
-
P03_NDATA returns the dimension of the data vector for problem 3.
-
P03_STORY prints the "story" for problem 3.
-
P03_TITLE returns the title of problem 3.
-
P03_TYPE returns the type of problem 3.
-
P04_DAT returns the data vector for problem 4.
-
P04_LIM returns the limits of the approximation interval for problem 4.
-
P04_NDATA returns the dimension of the data vector for problem 4.
-
P04_STORY prints the "story" for problem 4.
-
P04_TITLE returns the title of problem 4.
-
P04_TYPE returns the type of problem 4.
-
P05_DAT returns the data vector for problem 5.
-
P05_LIM returns the limits of the approximation interval for problem 5.
-
P05_NDATA returns the dimension of the data vector for problem 5.
-
P05_STORY prints the "story" for problem 5.
-
P05_TITLE returns the title of problem 5.
-
P05_TYPE returns the type of problem 5.
-
P06_DAT returns the data vector for problem 6.
-
P06_LIM returns the limits of the approximation interval for problem 6.
-
P06_NDATA returns the dimension of the data vector for problem 6.
-
P06_STORY prints the "story" for problem 6.
-
P06_TITLE returns the title of problem 6.
-
P06_TYPE returns the type of problem 6.
-
P07_DAT returns the data vector for problem 7.
-
P07_LIM returns the limits of the approximation interval for problem 7.
-
P07_NDATA returns the dimension of the data vector for problem 7.
-
P07_STORY prints the "story" for problem 7.
-
P07_TITLE returns the title of problem 7.
-
P07_TYPE returns the type of problem 7.
-
P08_DAT returns the data vector for problem 8.
-
P08_LIM returns the limits of the approximation interval for problem 8.
-
P08_NDATA returns the dimension of the data vector for problem 8.
-
P08_STORY prints the "story" for problem 8.
-
P08_TITLE returns the title of problem 8.
-
P08_TYPE returns the type of problem 8.
-
P09_DAT returns the data vector for problem 9.
-
P09_LIM returns the limits of the approximation interval for problem 9.
-
P09_NDATA returns the dimension of the data vector for problem 9.
-
P09_STORY prints the "story" for problem 9.
-
P09_TITLE returns the title of problem 9.
-
P09_TYPE returns the type of problem 9.
-
P10_DAT returns the data vector for problem 10.
-
P10_LIM returns the limits of the approximation interval for problem 10.
-
P10_NDATA returns the dimension of the data vector for problem 10.
-
P10_STORY prints the "story" for problem 10.
-
P10_TITLE returns the title of problem 10.
-
P10_TYPE returns the type of problem 10.
-
P11_DAT returns the data vector for problem 11.
-
P11_LIM returns the limits of the approximation interval for problem 11.
-
P11_NDATA returns the dimension of the data vector for problem 11.
-
P11_STORY prints the "story" for problem 11.
-
P11_TITLE returns the title of problem 11.
-
P11_TYPE returns the type of problem 11.
-
POINT_INSIDE_BOX_2D determines if a point is inside a box in 2D.
-
PS_COLOR_LINE handles the line color.
-
PS_COLOR_LINE_SET sets the line color.
-
PS_COMMENT inserts a comment into the PostScript file.
-
PS_DEFAULT sets the internal settings to their default values
-
PS_FILE_CLOSE closes a PostScript file.
-
PS_FILE_HEAD writes header information to a PostScript file.
-
PS_FILE_OPEN opens a new version of a PostScript file with a given name.
-
PS_FILE_TAIL writes trailer information to a PostScript file.
-
PS_GRID_CARTESIAN draws a cartesian grid.
-
PS_LINE_CLOSED adds the graph of a closed line to a PostScript file.
-
PS_LINE_OPEN adds the graph of a line to a PostScript file.
-
PS_MARK_CIRCLE marks a point with a small open circle.
-
PS_PAGE_HEAD writes header information on a new page.
-
PS_PAGE_TAIL writes tail information at the end of a page.
-
PS_SETTING_INT sets, gets, or prints integer internal PS_WRITE parameters.
-
PS_SETTING_REAL sets, gets, or prints real internal PS_WRITE parameters.
-
R8_SWAP swaps two R8's.
-
R8VEC2_PRINT prints a pair of R8VEC's.
-
S_EQI is a case insensitive comparison of two strings for equality.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
-
TIMESTRING writes the current YMDHMS date into a string.
You can go up one level to
the FORTRAN90 source codes.
Last revised on 16 November 2006.