home *** CD-ROM | disk | FTP | other *** search
- tpzod (m,xo,xh,y,tpa)
-
- /*to evaluate the definite integral of a function */
- /*using the Trapezoidal Rule. */
-
- int m;
- float xo,xh,y[],*tpa;
-
- {
- int i,tm;
- float di,ar;
-
- tm = m - 1;
- di = (xh - xo)/(tm*2.);
- *tpa = 0.;
-
- for(i = 0; i <= m-2; i++)
- {
- ar = di * (y[i] + y[i + 1]);
- *tpa = *tpa + ar;
- }
- }