     SPLINE(1)                                                         SPLINE(1)
                                    October 1996

     NAME
          spline-interpolate using splines under tension

     SYNOPSIS
          spline
           [infile  [outfile]]  [options]

     DESCRIPTION
          spline reads pairs of numbers (x- and y-values) from the standard
          input (or the given file), generates a smooth curve through the
          points, and writes to the standard output (or given file) points from
          the smooth curve.  The curve is a spline under tension (see
          references), which is somewhat "tighter" than a cubic spline, and less
          likely to have spurious inflection points.

          A command used to create output data is inserted as a comment,
          starting with "#", in the first line of output.

          As with graph, each pair of points may optionally be followed by a
          comment.  If the comment is surrounded by quotes "...", the comment
          may contain spaces.  The given points, and their comments if any, will
          be included in the output.  The interpolation may optionally be
          restarted after each label, so that a family of curves may be
          processed together (see the -b option).

          Input lines starting with "#" or ";" are copied to the beginning of
          the output file, with ";" replaced by "#", but are otherwise ignored.
          A "#" or ";" anywhere else in the line introduces a comment which is
          discarded.  Other lines not beginning with a number, including blank
          lines, are ignored.

          If the -c switch is not used, the input points must be from a function
          - that is, the x values must be either strictly increasing or strictly
          decreasing.  The output points will also be from a function.  (If the
          -b switch is used, this restriction applies only within each segment.)

          If the -c switch is used (indicating a general curve), the input
          points need not be from a function, but each pair of points must be
          separated from the previous pair by a finite distance.  (If the -b
          switch is used, this restriction applies only within each segment.)

     OPTIONS
          Options can appear before, among, or after file names provided a file
          name cannot be mistaken for the parameter of an option.

          -a [step [start]]
               Input data contains only y values - generate automatic abscissas
               at intervals of step (default 1) starting at start (default 0).

          -b   break the interpolation at each label.  That is, the input curve
               is divided into sections with the last point in each section

                                        - 1 -         Formatted:  April 24, 2001

     SPLINE(1)                                                         SPLINE(1)
                                    October 1996

               marked by a label (which may be empty: "").  A separate
               interpolating curve is to be found for each section.  In this
               case, the requirements on the number of intervals (specified by
               the -n switch or defaulted) and the interpolation range
               (specified by the -x switch) are applied to each section
               independently.

          -c   general curve rather than function.  In this case, the curve is
               parameterized on the polygonal arclength from the first to the
               last given point, with the whole length scaled to be 1.  Thus,
               the values min and max for the -x switch should satisfy 0 <= min
               < max <= 1. The -s and -c switches cannot be used together.

          -i file
               Explicit interpolation at x values given in file.  Only 1st
               number on each line of file is used - rest of line is ignored.
               Lines that don't start with a number are ignored.  With the -c
               switch, use -ix rather than -i.

          -ix file

          -iy file

          -iz file
               Implicit interpolation at x (y, z) values from the file. Only 1st
               number on each line of file is used - rest of line is ignored.
               Lines that don't start with a number are ignored.  Without the -c
               switch, use -i rather than -ix.

          -n num
               interpolate over num intervals (default is 100), yielding n+1
               points.

          -q   Quadruple: increase the number of intervals fourfold.

          -s [num [num]]
               Specify slopes at beginning and end of curve.  Slopes not given
               are assumed to be zero.  Without the -s switch, slopes are
               determined from other information. If only one slope is to be
               specified, the other can be given as "n" (for "natural").  The -s
               and -c switches cannot be used together.

          -t num
               Specify tension in interpolating curve.  Tension of 50 gives
               almost polygonal line, tension of .01 gives almost cubic spline.
               Tension must be positive.  Default is 1.

          -x [min [max]]
               Interpolate from min to max only.  min and max should be in the
               range of the given x values, except that if the -c switch is used
               they should satisfy 0 <= min < max <= 1.

                                        - 2 -         Formatted:  April 24, 2001

     SPLINE(1)                                                         SPLINE(1)
                                    October 1996

          -xl  take log of x values before interpolating, take exponential
               afterwards (probably necessary if -xl switch is needed for graph
               ).

          -yl  take log of y values before interpolating, take exponential
               afterwards (probably necessary if -yl switch is needed for graph
               ).

          -zl  take log of z values before interpolating, take exponential
               afterwards (implies -3)

          -xt -yt -zt
               take tanh of x, y, or z values before interpolating, take arc
               tanh afterwards.  Data values are restricted to (0, 1).  (-zt
               implies -3).

          -3   3D curve: each input line has an x, y, and z

     NOTES
          Inspired by the Unix routine, but afflicted with creeping featuritis.

     REFERENCES
          A. K. Cline, "Scalar- and Planar- Valued Curve Fitting Using Splines
          Under Tension", Communications of the ACM v 17 n 4 p 218-223 (Apr 74).

          Schweikert, D. G. "An interpolation curve using a spline in tension",
          J. Math. and Physics v 45 p 312-317 (1966).

     SEE ALSO
          graph, smooth, dots

     AUTHOR
          Copyright (c) 1985 - 1992  James R. Van Zandt

          Resale forbidden, copying for personal use encouraged.

                                        - 3 -         Formatted:  April 24, 2001