14 * Return the area enclosed by all of the curves. The algorithm
15 * used is the same as the trapizoidal rule for integration.
31 maxima = (floatish *) xmalloc(nsamples * sizeof(floatish));
32 for (i = 0; i < nsamples; i++) {
36 for (i = 0; i < nidents; i++) {
37 for (ch = identtable[i]->chk; ch; ch = ch->next) {
38 for (j = 0; j < ch->nd; j++) {
39 bucket = ch->d[j].bucket;
40 value = ch->d[j].value;
41 if (bucket >= nsamples)
42 Disaster("bucket out of range");
43 maxima[ bucket ] += value;
50 for (i = 1; i < nsamples; i++) {
51 base = samplemap[i] - samplemap[i-1];
52 if (maxima[i] > maxima[i-1]) {
53 trap = base * maxima[i-1] + ((base * (maxima[i] - maxima[i-1]))/ 2.0);
55 trap = base * maxima[i] + ((base * (maxima[i-1] - maxima[i]))/ 2.0);