# TEST_APPROX Test Data for Approximation Algorithms

TEST_APPROX is a C library which provides sets of test data for approximation algorithms.

TEST_APPROX contains a number of vectors of data (X(1:N),Y(1:N)) for which no underlying functional relationship is given.

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.

The problems available include:

1. p01_data.png: DeBoor example, Mars position data
2. p02_data.png: DeBoor example, roughly linear data
3. p03_data.png: The pulse data, 0 0 0 0 0 1 0 0 0 0 0;
4. p04_data.png: The jump data, 0 0 0 0 0 1/2 1 1 1 1 1;
5. p05_data.png: DeBoor's Titanium Property data;
6. p06_data.png: The Sawtooth data;
7. p07_data.png: Concavity test data;
8. p08_data.png: Extrapolation test data;
9. p09_data.png: Sunspot data, 1700-1960;
10. p10_data.png: 100 samples of y=2+5x+10*N(0,1), where N(0,1) is a random normal value with 0 mean and unit variance;

### Languages:

TEST_APPROX is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

BERNSTEIN_POLYNOMIAL, a C library which evaluates the Bernstein polynomials, useful for uniform approximation of functions;

CHEBYSHEV, a C library which computes the Chebyshev interpolant/approximant to a given function over an interval.

DIVDIF, a C library which includes many routines to construct and evaluate divided difference interpolants.

SPLINE, a C library which includes many routines to construct and evaluate spline interpolants and approximants.

TEST_APPROX, a dataset directory which contains sets of data (x,y) for which an approximating formula is desired.

TEST_INTERP_1D, a C library which defines test problems for interpolation of data y(x), depending on a 1D argument.

### Reference:

1. Samuel Conte, Carl deBoor,
Elementary Numerical Analysis,
Second Edition,
McGraw Hill, 1972,
ISBN: 07-012446-4,
LC: QA297.C65.
2. Carl deBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.
3. Max Waldmeier,
The Sunspot-Activity in the Years 1610-1960,
Shulthess, 1961,
LC: QB525.W34.

### Examples and Tests:

TEST07 creates data files for an Overhauser spline interpolant to data set 7.

TEST08 creates data files for a cubic spline interpolant to data set 7.

TEST10 creates data files for a B-spline approximant to data set 7.

TEST11 creates data files for a beta spline approximant to data set 7:

TEST12 creates data files for a Bernstein approximant to data set 5.

TEST13 creates data files for a cubic spline interpolant to data set 5.

### List of Routines:

• P00_DAT returns the data vector for any problem.
• P00_DATA_NUM returns the dimension of the data vector for any problem.
• P00_PROB_NUM returns the number of test problems.
• P00_STORY prints the "story" for any problem.
• P00_TITLE returns the title of any problem.
• P01_DAT returns the data vector for problem 1.
• P01_DATA_NUM returns the dimension of the data vector for problem 1.
• P01_STORY prints the "story" for problem 1.
• P01_TITLE returns the title of problem 1.
• P02_DAT returns the data vector for problem 2.
• P02_DATA_NUM returns the dimension of the data vector for problem 2.
• P02_STORY prints the "story" for problem 2.
• P02_TITLE returns the title of problem 2.
• P03_DAT returns the data vector for problem 3.
• P03_DATA_NUM 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.
• P04_DAT returns the data vector for problem 4.
• P04_DATA_NUM 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.
• P05_DAT returns the data vector for problem 5.
• P05_DATA_NUM 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.
• P06_DAT returns the data vector for problem 6.
• P06_DATA_NUM 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.
• P07_DAT returns the data vector for problem 7.
• P07_DATA_NUM 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.
• P08_DAT returns the data vector for problem 8.
• P08_DATA_NUM 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.
• P09_DAT returns the data vector for problem 9.
• P09_DATA_NUM returns the dimension of the data vector for problem 9.
• P09_STORY prints the "story" for problem 09
• P09_TITLE returns the title of problem 09.
• P10_DAT returns the data vector for problem 10.
• P10_DATA_NUM 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.
• R8VEC_COPY copies an R8VEC.
• R8VEC2_PRINT prints an R8VEC2.
• R8VEC2_WRITE writes an R8VEC2 file.

You can go up one level to the C source codes.

Last revised on 08 February 2012.