>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_SPINTEG

IMSL_SPINTEG

IMSL_SPINTEG

The IMSL_SPINTEG function computes the integral of a one- or two-dimensional spline.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The IMSL_SPINTEG function can be used to integrate splines of the following type:

If s = Spline is a one-dimensional piecewise polynomial or B-spline, then IMSL_SPINTEG computes:

If spline is a one-dimensional B-spline, then this function uses identity (22) of de Boor (1978, p. 115).

If s = Spline is a two-dimensional, tensor-product spline, then the arguments c and d are required, and IMSL_SPINTEG computes:

This function uses the (univariate integration) identity (22) of de Boor (1978, p. 151):

where t0 ≤ x ≤ tr. It assumes (for all knot sequences) that the first and last k knots are stacked; that is, t0 = . . . = tk – 1 and tn = . . . = tn + k – 1, where k is the order of the spline in the x or y direction.

Example


This example computes a cubic spline interpolant to function values. The values of the integral of this spline are then compared with the exact integral values. Since the default settings are being used, the interpolant is determined by the not-a-knot condition (de Boor 1978).

n = 21
; Generate the data.
x = FINDGEN(n)/(n - 1)
f = SIN(15 * x)
pp = IMSL_CSINTERP(x, f)
; Compute the interpolant. results = FLTARR(22, 4)
; Define an array to hold some results to be output later. FOR i = n/2, 3 * n/2 DO BEGIN & $
x2 = i/FLOAT(2 * n - 2) & $
  y = IMSL_SPINTEG(0, x2, pp)	& $
  results[i - n/2, *] = $
  [x2, (1 - COS(15 * x2))/15, y, $ ABS((1 - COS(15 * x2))/15 - y)] & $
; Loop over different limits of integration and compare the
; results with the true answer. ENDFOR
PM, results, FORMAT = '(4f12.4)', $
  Title	= '	X	True	Approx	Error'
  ; Output the results.
   X         True      Approx    Error
  0.2500    0.1214    0.1215    0.0001
  0.2750    0.1036    0.1037    0.0001
  0.3000    0.0807    0.0808    0.0001
  0.3250    0.0559    0.0560    0.0001
  0.3500    0.0325    0.0327    0.0001
  0.3750    0.0139    0.0141    0.0002
  0.4000    0.0027    0.0028    0.0002
  0.4250    0.0003    0.0004    0.0002
  0.4500    0.0071    0.0073    0.0002
  0.4750    0.0223    0.0224    0.0001
  0.5000    0.0436    0.0437    0.0001
  0.5250    0.0681    0.0682    0.0001
  0.5500    0.0924    0.0925    0.0001
  0.5750    0.1131    0.1132    0.0001
  0.6000    0.1274    0.1275    0.0001
  0.6250    0.1333    0.1333    0.0001
  0.6500    0.1298    0.1299    0.0001
  0.6750    0.1176    0.1177    0.0001
  0.7000    0.0984    0.0985    0.0001
  0.7250    0.0747    0.0748    0.0001
  0.7500    0.0499    0.0500    0.0001
  0.7750    0.0274    0.0276    0.0001

Errors


Warning Errors

MATH_SPLINE_LEFT_ENDPT: Left endpoint of x integration is not within the knot sequence. Integration occurs only from tOrder – 1 to B.

MATH_SPLINE_RIGHT_ENDPT: Right endpoint of x integration is not within the knot sequence. Integration occurs only from tOrder – 1 to A.

MATH_SPLINE_LEFT_ENDPT_1: Left endpoint of x integration is not within the knot sequence. Integration occurs only from B to tSpline_Space_Dim – 1.

MATH_SPLINE_RIGHT_ENDPT_1: Right endpoint of x integration is not within the knot sequence. Integration occurs only from A to tSpline_Space_Dim – 1.

MATH_SPLINE_LEFT_ENDPT_2: Left endpoint of y integration is not within the knot sequence. Integration occurs only from tOrder – 1 to D.

MATH_SPLINE_RIGHT_ENDPT_2: Right endpoint of y integration is not within the knot sequence. Integration occurs only from tOrder – 1 to C.

MATH_SPLINE_LEFT_ENDPT_3: Left endpoint of y integration is not within the knot sequence. Integration occurs only from D to tSpline_Space_Dim – 1.

MATH_SPLINE_RIGHT_ENDPT_3: Right endpoint of y integration is not within the knot sequence. Integration occurs only from C to tSpline_Space_Dim – 1.

Fatal Errors

MATH_KNOT_MULTIPLICITY: Multiplicity of the knots cannot exceed the order of the spline.

MATH_KNOT_NOT_INCREASING: Knots must be nondecreasing.

Syntax


Result = IMSL_SPINTEG(A, B, C, D, Spline)

or

Result = IMSL_SPINTEG(A, B, C, D, Spline)

Return Value


If spline is a one-dimensional spline, then the returned value is the integral from a to b of spline. If spline is a two-dimensional, tensor-product spline, then the returned value is the value of the integral of Spline over the rectangle [A, B] x [C, D]. If no value can be computed, NaN (Not a Number) is returned.

Arguments


If integration of a one-dimensional spline is desired, then arguments a, b, and spline are required. If integration of a two-dimensional spline is desired, then a, b, c, d, and spline are required.

A

Right endpoint of integration.

B

Left endpoint of integration.

C

Right endpoint of integration for the second variable of the tensor-product spline. This argument should only be used if Spline is a two-dimensional, tensor-product spline.

D

Left endpoint of integration for the second variable of the tensor-product spline. This argument should only be used if spline is a two-dimensional, tensor-product spline.

Spline

Structure that represents the spline to be integrated.

Keywords


None

Version History


6.4

Introduced

See Also


IMSL_BSINTERP, IMSL_BSLSQ, IMSL_CONLSQ, IMSL_CSINTERP, IMSL_CSSHAPE, IMSL_CSSMOOTH



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us