The CRVLENGTH function computes the length of a curve with a tabular representation, Y[i] = F(X[i]).

Note: Data that is highly oscillatory requires a sufficient number of samples for an accurate curve length computation.

This routine is written in the IDL language. Its source code can be found in the file crvlength.pro in the lib subdirectory of the IDL distribution.

Example


;Define a 21-element vector of X-values:
x = [-2.00, -1.50, -1.00, -0.50, 0.00, 0.50, 1.00, 1.50, 2.00, $
2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50, 6.00, 6.50, $
7.00, 7.50, 8.00]
;Define a 21-element vector of Y-values:
y = [-2.99, -2.37, -1.64, -0.84, 0.00, 0.84, 1.64, 2.37, 2.99, $
3.48, 3.86, 4.14, 4.33, 4.49, 4.65, 4.85, 5.13, 5.51, $
6.02, 6.64, 7.37]
;Compute the length of the curve:
result = CRVLENGTH(x, y)
Print, result

IDL prints:

14.8115

Syntax


Result = CRVLENGTH( X, Y [, /DOUBLE] )

Return Value


Returns the curve length.

Arguments


X

An n-element vector containing the independent variable values. X may be of type integer, floating point, or double-precision floating-point. X must contain at least three elements, and values must be specified in ascending order. Duplicate X values will result in a warning message.

Y

An n-element single- or double-precision floating-point vector.

Keywords


DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

Version History


5.0

Introduced

See Also


INT_TABULATED, PNT_LINE