ftcurvi

ftcurvi calculates integrals of an interpolatory spline under tension between two user-specified limits. ftcurvi is in the Fitgrid package -- a package containing 1D and 2D interpolators using cubic splines under tension.


Synopsis

    function ftcurvi(
        xl[1] : float,
        xr[1]:  float,
        xi[*] : float,
        yi[*] : float,
    )


Arguments

xl
A scalar value containing the lower limit of the integration.
xr
A scalar value containing the upper limit of the integration.
xi
A 1D array of any size (npts) containing the abscissae for the input function.
yi
A 1D array containing the npts functional values of the input function -- yi(k) is the functional value at xi(k) for k=0,npts-1.

Return value

ftcurvi returns a scalar value that contains the integral of the interpolated function from xl to xr.


Description

There are some parameters that can alter the behavior of ftcurvi. These parameters all have reasonable default values. However, users may change any of these parameters by invoking ftsetp prior to calling ftcurvi. ftcurvi is called after all of the desired values for control parameters have been set.

Control parameters that apply to ftcurvi are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The values for sl1 and sln specify the slope of the curve at the first point and last point, respectively.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sl1 is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

You can extrapolate values with ftcurvi (that is calculate interpolated values for abscissae outside of the domain of the input), but these values are, in general, unreliable.


Example

begin
  xi = (/  0.00,   2.00,   5.00,   8.00,  10.00,  13.00,     \
          15.00,  18.00,  21.00,  23.00,  30.00         /)
  yi = (/  1.00,   0.81,   0.00,  -0.81,  -1.00,  -0.84,     \
          -0.56,   0.04,   0.73,   1.18,   2.0          /)

  npts = 201
  xo   = fspan(0.,30.,npts)
  
  integral = ftcurvi(10., 30., xi, yi)
end

Reference Manual Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.7 $ $Date: 1998/11/11 23:32:17 $