HTML automatically generated with rman
Table of Contents

Name

tabspline - interpolate in a table

Synopsis

tabspline [parameter=value]

Description

tabspline interpolates any function y=f(x) that was given in (ascii) tabular format. It actually is not required that x is monotonically increasing or decreasing, the function could be a parametrized table (x=f(t),y=g(t)). The interpolation can occur in X as well as Y, and uses either the GSL library, if present, or spline(3NEMO) if not.

If GSL is enabled, various spline interpolations can be selected (including linear), as well as computation of the first two derivates. Note that with ascii tables enough precision must be given to give the higher order derivatives a change to be computed accurately enough. This means %20.16f or something better should be given in all tab* programs. See example below.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=
Input file, a standard ASCII table. No default.
xcol=
X column [1].
ycol=
Y Column [2].
x=
For this X, find the corresponding Y. Can be an array using nemoinp(3NEMO) notation. The mnemonic all can be used to for the same values as obtained from xcol=. [default: not used]
y=
For this Y, find the corresponding X Can be an array using nemoinp(3NEMO) notation. The mnemonic all can be used to for the same values as obtained from ycol=. [default: not used]
n=
How many to find. By default it will find all possible roots, but one can limit the number using this keyword. (0=all). [0]
format=C-fmt
Output format in C format (printf(3) ) notation. [Default: %g]
type=spline-type
The spline type for interpolations. Currently GSL supports: linear, cspline, cspline_periodic, akima, and akima_periodic.
nder=
Number of derivates that will be returned. Only 1 and 2 are supported, and currently only GSL enabled programs can compute derivates. Default : 0

Examples

Here is an cute way to estimate sqrt(2) :
% nemoinp 1:2:0.001 | tabmath - - ’%1*%1’ | tabspline - y=2
1.41421 2

or a little more serious to check the accuracy of the GSL interpolation types, use 100 values between 1 and 2 to evaluate the accuracy of dermining sqrt(2) :

% nemoinp 1:2:0.01 format=%20.16f | tabmath - - ’%1*%1’ format=%20.16f |\
    tabspline - y=2 format=%20.16f type=linear  | tabmath - - ’%1-sqrt(2)’
 1.4142049469964664   2.0000000000000000 -8.61538e-06
% nemoinp 1:2:0.01 format=%20.16f | tabmath - - ’%1*%1’ format=%20.16f |\
    tabspline - y=2 format=%20.16f type=akima   | tabmath - - ’%1-sqrt(2)’
 1.4142135470218800   2.0000000000000000 -1.53512e-08
% nemoinp 1:2:0.01 format=%20.16f | tabmath - - ’%1*%1’ format=%20.16f |\
    tabspline - y=2 format=%20.16f type=cspline | tabmath - - ’%1-sqrt(2)’
 1.4142135625037890   2.0000000000000000 1.30694e-10

See Also


table(5NEMO), spline(3NEMO)

Files


src/kernel/tab/tabspline.c    source code

Author

Peter Teuben

Update History


15-Apr-98    V2.0 TOOLBOX made functional for Sally    PJT
16-apr-98    split code and placed in src/kernel/tab     PJT
23-jan-01    V2.1 added x=,y= arrays for Mousumi    PJT
5-apr-01    V2.2: added format=    PJT
9-sep-01    V3.0: GSL enabled, can use spline options    PJT
22-jul-02    V3.1: documented nder        PJT
31-aug-02    V3.3: allow x=all and y=all    PJT


Table of Contents