Previous: Advanced Use of spline, Up: spline


7.3 spline command-line options

The spline program will interpolate vector-valued functions of a scalar variable t, and curves in d-dimensional space. The algorithms used by spline are similar to those discussed in D. Kincaid and [E.] W. Cheney, Numerical Analysis (2nd ed., Brooks/Cole, 1996), section 6.4, and C. de Boor, A Practical Guide to Splines (Springer-Verlag, 1978), Chapter 4.

Input file names may be specified anywhere on the command line. That is, the relative order of font names and command-line options does not matter. If no file names are specified, or the file name ‘- is specified, the standard input is read.

An input file may contain more than a single dataset. Unless the ‘-a’ or ‘-A’ options are used (see below), each dataset is expected to consist of a sequence of data points, given as alternating t and y values. t is the scalar independent variable, and y is the vector-valued dependent variable. The dimensionality of y is specified with the ‘-d’ option (the default is 1).

If the input file is in ASCII format (the default), its datasets are separated by blank lines. An input file may also contain any number of comment lines, which must begin with the comment character `#'. Comment lines are ignored. They are not treated as blank, i.e., they do not interrupt a dataset in progress.

The options to spline are listed below. There are three sorts of option:

  1. Options specifying the type of interpolation to be performed on each dataset.
  2. Options specifying the input or output format.
  3. Options requesting information (e.g., ‘--help’).

Options that take an argument are followed, in parentheses, by the type and default value of the argument.

The following options specify the type of interpolation to be performed on each dataset.

-f
--filter
Use a local interpolation algorithm (the cubic Bessel algorithm), so that spline can be used as a real-time filter. The slope of the interpolating curve at each point in a dataset will be chosen by fitting a quadratic function through that point and the two adjacent points in the dataset. If ‘-f’ is specified then the ‘-t’ option, otherwise optional, must be used as well. Also, if ‘-f’ is specified then the ‘-k’, ‘-p’, and ‘-T’ options may not be used.

If ‘-f’ is not specified, then a different (global) interpolation algorithm will be used.

-k k
--boundary-condition k
(Float, default 1.0.) Set the boundary condition parameter for each constructed spline to be k. In each of its components, the spline will satisfy the two boundary conditions y”[0]=ky”[1] and y”[n]=ky”[n-1]. Here y[0] and y[1] signify the values of a specified component of the vector-valued dependent variable y at the first two points of a dataset, and y[n-1] and y[n] the values at the last two points. Setting k to zero will yield a `natural' spline, i.e., one that has zero curvature at the two ends of the dataset. The ‘-k’ option may not be used if ‘-f’ or ‘-p’ is specified.
-n n
--number-of-intervals n
(Positive integer, default 100.) Subdivide the interval over which interpolation occurs into n subintervals. The number of data points computed, and written to the output, will be n+1.
-p
--periodic
Construct a periodic spline. If this option is specified, the y values for the first and last points in each dataset must be equal. The ‘-f’ and ‘-k’ options may not be used if ‘-p’ is specified.
-T tension
--tension tension
(Float, default 0.0.) Set the tension in each interpolating spline to be tension. Between each pair of successive points in a dataset, the constructed spline will satisfy the differential equation y””=sgn(tension)*(tension^2)y” in each of its components. If tension equals zero, the spline will be piecewise cubic. As tension increases to positive infinity, the spline will converge to a polygonal line. The ‘-T’ option may not be used if ‘-f’ is specified.
-t tmin tmax [tspacing]
--t-limits tmin tmax [tspacing]
For each dataset, set the interval over which interpolation occurs to be the interval between tmin and tmax. If tspacing is not specified, the interval will be divided into the number of subintervals specified by the ‘-n’ option. If the-t’ option is not used, the interval over which interpolation occurs will be the entire range of the independent variable in the dataset. The ‘-t’ option must always be used if the ‘-f’ option is used to request filter-like behavior (see above).

The following options specify the format of the input file(s) and the output file.

-d dimension
--y-dimension dimension
(Integer, default 1.) Set the dimensionality of the dependent variable y in the input and output files to be dimension.
-I data-format
--input-format data-format
(Character, default ‘a’.) Set the data format for the input file(s) to be data-format. The possible data formats are as follows.
a
ASCII format. Each file is a sequence of floating point numbers, interpreted as the t and y coordinates of the successive data points in a dataset. If y is d-dimensional, there will be d+1 numbers for each point. The t and y coordinates of a point need not appear on the same line, and points need not appear on different lines. But if a blank line occurs (i.e., two newlines in succession are seen), it is interpreted as the end of a dataset, and the beginning of the next.
f
Single precision binary format. Each file is a sequence of floating point numbers, interpreted as the t and y coordinates of the successive data points in a dataset. If y is d-dimensional, there will be d+1 numbers for each point. Successive datasets are separated by a single occurrence of the quantity FLT_MAX, which is the largest possible single precision floating point number. On most machines this is approximately 3.4x10^38.
d
Double precision binary format. Each file is a sequence of double precision floating point numbers, interpreted as the t and y coordinates of the successive data points in a dataset. If y is d-dimensional, there will be d+1 numbers for each point. Successive datasets are separated by a single occurrence of the quantity DBL_MAX, which is the largest possible double precision floating point number. On most machines this is approximately 1.8x10^308.
i
Integer binary format. Each file is a sequence of integers, interpreted as the t and y coordinates of the successive data points in a dataset. If y is d-dimensional, there will be d+1 numbers for each point. Successive datasets are separated by a single occurrence of the quantity INT_MAX, which is the largest possible integer. On most machines this is 2^31-1.

-a [step_size [lower_limit]]
--auto-abscissa [step_size [lower_limit]]
(Floats, defaults 1.0 and 0.0.) Automatically generate values for the independent variable (t). Irrespective of data format (‘a’, ‘f’, ‘d’, or ‘i), this option specifies that the values of the independent variable (t) are missing from the input file: the dataset(s) to be read contain only values of the dependent variable (y), so that if y is d-dimensional, there will be only d numbers for each point. The increment from each t value to the next will be step_size, and the first t value will be lower_limit.
-A
--auto-dist-abscissa
Automatically generate values for the independent variable (t). This is a variant form of the ‘-a’ option. The increment from each t value to the next will be the distance between the corresponding y values, and the first t value will be 0.0. This option is useful when interpolating curves rather than functions (see Advanced Use of spline).
-O data-format
--output-format data-format
(Character, default ‘a’.) Set the data format for the output file to be data-format. The interpretation of the data-format argument is the same as for the ‘-I’ option.
-P significant-digits
--precision significant-digits
(Positive integer, default 6.) Set the numerical precision for the t and y values in the output file to be significant-digits. This takes effect only if the output file is written in ‘a’ format, i.e., in ASCII.
-s
--suppress-abscissa
Omit the independent variable t from the output file; for each point, supply only the dependent variable y. If y is d-dimensional, there will be only d numbers for each point, not d+1. This option is useful when interpolating curves rather than functions (see Advanced Use of spline).

The following options request information.

--help
Print a list of command-line options, and then exit.
--version
Print the version number of spline and the plotting utilities package, and exit.