[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
New Address!   --   Neue Adresse!
[Uni logo]


TSUM Source code in tsum.pro

TSUM

Name
       TSUM
Purpose
       Trapezoidal summation of the area under a curve.
Explanation
       Adapted from the procedure INTEG in the IUE procedure library.
Calling Sequence
       Result = TSUM(y)
              or
       Result = TSUM( x, y, [ imin, imax ] )
Input Parameters
       x = array containing monotonic independent variable.  If omitted, then
               x is assumed to contain the index of the y variable.
               x = lindgen( N_elements(y) ).
       y = array containing dependent variable y = f(x)
Optional Input Parameters
       imin = scalar index of x array at which to begin the integration
               If omitted, then summation starts at x[0].
       imax = scalar index of x value at which to end the integration
               If omitted then the integration ends at x[npts-1].
Output Parameters
       result = area under the curve y=f(x) between x[imin] and x[imax].
Example
       IDL> x = [0.0,0.1,0.14,0.3]
       IDL> y = sin(x)
       IDL> print,tsum(x,y)    ===>  0.0445843
       In this example, the exact curve can be computed analytically as
       1.0 - cos(0.3) = 0.0446635
Procedure
       The area is determined of individual trapezoids defined by x[i],
       x[i+1], y[i] and y[i+1].
       If the data is known to be at all smooth, then a more accurate
       integration can be found by interpolation prior to the trapezoidal
       sums, for example, by the standard IDL User Library int_tabulated.pro.
Revision History
       Written, W.B. Landsman, STI Corp. May 1986
       Modified so X is not altered in a one parameter call Jan 1990
       Converted to IDL V5.0   W. Landsman   September 1997
       Allow non-integer values of imin and imax  W. Landsman April 2001
       Fix problem if only 1 parameter supplied W. Landsman June 2002

Last modified by pro2html on 2002 June 29 at 03:43 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically