SPLINE(1)
β¨ SPLINE(1) β¨
okay bestie, so this is spline from the GNU Plotting Utilities and it is literally the moment π
π NAME π
spline β interpolate datasets using splines under tension
π¦ SYNOPSIS π¦
spline [ options ] [ files ]
πΈ DESCRIPTION πΈ
so spline reads datasets from standard input or from one or more files, and it fits a smooth curve (a "spline", hence the name, iykyk) through each dataset. Then an interpolated version of each dataset β made of points from that smooth curve β gets written to standard output. slay.
Unless you use the -a or -A options (more on those below), each dataset should be a sequence of values for a vector-valued function of a single scalar variable. Translation: each dataset is a sequence of data points, given as alternating t and y values. t is a scalar independent variable, and y is a vector-valued dependent variable. The dimensionality of y is set with the -d option (default dimensionality is 1, bestie). And between each data point and the next, t should increase. no going backwards π
ββοΈ
An input file can contain more than a single dataset. If an input file is in ASCII format (which is the default), its datasets should be separated by blank lines. The t and y values of the data points in each dataset may be arranged arbitrarily, so long as they're separated by white space. And besides datasets, an input file may contain any number of comment lines, which should 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. so you can comment right in the middle of a dataset and it's fine, the vibe stays intact π
Options and file names may be interspersed on the command line, but the options are processed before the file names are read. If -- is seen, it is interpreted as the end of the options. If no file names are specified, or the file name - is encountered, the standard input is read.
The type of interpolation, and the format of the input and output files, may be selected by command-line options. we love a customizable queen π
β¨ OPTIONS β¨
π Interpolation-Related Options
-f,--filterβ Use a local interpolation algorithm (the cubic Bessel algorithm), so thatsplinecan 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-fis specified then the-toption, otherwise optional, must be used as well. Also, if-fis specified then the-k,-p, and-Toptions may not be used. If-fis not specified, then the default (global) interpolation algorithm will be used.-k k,--boundary-condition kβ Set the boundary condition parameter for each constructed spline to bek. (The default value is1.0.) In each of its components, the spline will satisfy the two boundary conditionsy"[0]=ky"[1]andy"[n]=ky"[n-1]. Herey[0]andy[1]signify the values of a specified component of the vector-valued dependent variableyat the first two points of a dataset, andy[n-1]andy[n]the values at the last two points. Settingkto zero will yield a "natural" spline, i.e., one that has zero curvature at the two ends of the dataset. The-koption may not be used if-for-pis specified.-n n,--no-of-intervals nβ Subdivide the interval over which interpolation occurs intonsubintervals. The number of data points computed, and written to the output, will ben+1. The default value fornis100.-p,--periodicβ Construct a periodic spline. If this option is specified, theyvalues for the first and last points in each dataset must be equal. The-fand-koptions may not be used if-pis specified.-T tension,--tension tensionβ Each interpolating curve will be a spline under tension. This option sets the tension value (the default is0.0).
If tension equals zero, the curve will be a piecewise cubic spline. Increasing the tension above zero makes the curve "tighter", and reduces the likelihood of spurious inflection points. That's because between each pair of successive points in a dataset, the curve will satisfy the fourth-order differential equation y""=sgn(tension)*(tension^2)y" in each of its components. As tension increases to positive infinity, it will converge to a polygonal line. The -T option may not be used if -f is specified.
-t tmin tmax [tspacing],--t-spacing tmin tmax [tspacing]β For each dataset, set the interval over which interpolation occurs to be the interval betweentminandtmax. Iftspacingis not specified, the interval will be divided into the number of subintervals specified by the-noption.
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).
π Format-Related Options π
-d dimension,--y-dimension dimensionβ Set the dimensionality of the dependent variableyin the input and output files to bedimension. The default dimension is1.-I data-format,--input-format data-formatβ Set the data format for the input file(s) to bedata-format, which may be one of the following:aβ ASCII format (the default). Each file is a sequence of floating point numbers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Thetandycoordinates 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 thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantityFLT_MAX, which is the largest possible single precision floating point number. On most machines this is approximately3.4x10^38.dβ Double precision binary format. Each file is a sequence of double precision floating point numbers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantityDBL_MAX, which is the largest possible double precision floating point number. On most machines this is approximately1.8x10^308.iβ Integer binary format. Each file is a sequence of integers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantityINT_MAX, which is the largest possible integer. On most machines this is2^31-1.
-a [step_size [lower_limit]],--auto-abscissa [step_size [lower_limit]]β Automatically generate values fort, the independent variable (the default values ofstep_sizeandlower_limitare1.0and0.0, respectively).
Irrespective of data format (a, f, d, or i), this option specifies that the values of t are missing from the input file: the dataset(s) to be read contain only values of y, the dependent variable. So 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. This option is useful, e.g., when interpolating curves rather than functions.
-A,--auto-dist-abscissaβ Automatically generate values fort, the independent variable. This is a variant form of the-aoption. The increment from eachtvalue to the next will be the distance ind-dimensional space between the correspondingyvalues, and the firsttvalue will be0.0. That is,twill be "polygonal arclength". This option is useful when interpolating curves rather than functions.-O data-format,--output-format data-formatβ Set the data format for the output file to bedata-format. The interpretation ofdata-formatis the same as for the-Ioption. The default isa, i.e., ASCII format.-P significant-digits,--precision significant-digitsβ Set the numerical precision for thetandyvalues in the output file to besignificant-digits. This takes effect only if the output file is written inaformat, i.e., in ASCII.significant-digitsmust be a positive integer (the default is6).-s,--suppress-abscissaβ Omit the independent variabletfrom the output file; for each point, supply only the dependent variabley. Ifyisd-dimensional, there will be onlydnumbers for each point, notd+1. This option is useful when interpolating curves rather than functions.
π Informational Options π
--helpβ Print a list of command-line options, and exit.--versionβ Print the version number ofsplineand the plotting utilities package, and exit.
π EXAMPLES π
Typing
echo 0 0 1 1 2 0 | spline
will produce on standard output an interpolated dataset consisting of 101 data points. If graphed, this interpolated dataset will yield a parabola. iconic honestly π
It is sometimes useful to interpolate between a sequence of arbitrarily placed points in d-dimensional space, i.e., to "spline a curve" rather than a function. The -a and -s options are used for this. For example,
echo 0 0 1 0 1 1 0 1 | spline -d 2 -a -s
will produce on standard output a 101-point dataset that interpolates between the four points (0,0), (1,0), (1,1), and (0,1). The -d 2 option specifies that the dependent variable y is two-dimensional. The -a option specifies that the t values are missing from the input and should be automatically generated. The -s option specifies that the t values should be stripped from the output.
π AUTHORS π
spline was written by Robert S. Maier (rsm@math.arizona.edu), and it started out as an earlier version by Rich Murphey (rich@freebsd.org). iconic lineage honestly π«Ά
And the algorithms for constructing splines under tension? They're similar to the ones used in the FITPACK subroutine library, and they're ultimately due to Alan K. Cline (cline@cs.utexas.edu). So likeβ¦ credit where credit is due, bestie πβ¨
π SEE ALSO πΈ
- "The GNU Plotting Utilities Manual" β go read it, it's giving documentation π π
π BUGS π
Found a bug? Email bug reports to bug-gnu-utils@gnu.org. fr fr, they wanna hear about it πβ‘οΈπ§
okay and that's the whole page, bestie!! this one came from the FSF, dated Dec 1998, and it's page SPLINE(1) in the manual set β a certified classic, no cap ππβ¨ go make some tension splines, you absolute main character π¦
π¦ where this page comes from
- debian bookworm: plotutils 2.6-13
- debian trixie: plotutils 2.6-14+b3
- nixos 26.05: plotutils 2.6
- nixpkgs unstable: plotutils 2.6
- opensuse-leap 16.0: plotutils 2.6-160000.2.2 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: plotutils 2.6-160000.2.2 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: plotutils 2.6-160000.2.2 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: plotutils 2.6-160000.2.2 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- ubuntu jammy: plotutils 2.6-11
- ubuntu noble: plotutils 2.6-14build3
- ubuntu questing: plotutils 2.6-15
- ubuntu resolute: plotutils 2.6-15build1
- ubuntu stonking: plotutils 2.6-15build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms