next up previous contents
Next: Simpson's Rule Up: Integration Routines Previous: Integration Routines

Trapezoidal Rule

  In either Fortran or C, write a function subroutine of the form
C:        float trapint(float f[],float r[],float dr[],int N)

Fortran:  real function trapint(f,r,dr,N)
          integer N
          real f(N),r(N),dr(N)
which returns the result of using the trapezoidal rule to perform the integral

displaymath151

from values at the N+1 points tex2html_wrap_inline155 .

As input to this routine, the user supplies the values tex2html_wrap_inline157 , tex2html_wrap_inline159 , and tex2html_wrap_inline161 in the arrays r, dr, and f, respectively.



Tomas Arias
Tue Feb 8 13:35:07 EST 2000