HTBasic Help
×
Menu
Index
Trapezoid
Integration using the Trapezoid Rule.
 
Loading        LOADSUB ALL FROM "TRAPEZOID.HTS"
or LOADSUB FROM "MATHLIB.HTS"
 
Usage                REAL A(*),S,Y
Y=FNTrapezoid(A(*),S)
 
Description                
FNTrapezoid approximates the integral of the function whose samples are in the array A. The elements of A are assumed to be equally-spaced. The parameter s contains the value of the distance between adjacent elements of A.
 
The integral is calculated by summing half the value of the first and last points in A and the values of the interior points in A. This sum is multiplied by s. This method is often called the trapezoid rule, and is described in most texts on numerical mathematical methods.
 
Errors                
FNTrapezoid causes an HTBasic error if the array A contains fewer than 2 points.
 
See Also
Simpson