float trapezoid (float a, float b, int N) { float sum, h; int i; sum = integrand(a)/2; h = (b-a) / N; i = 1; while (i < N) { sum = sum + integrand(a + i*h); i = i + 1; } sum = sum + integrand(b)/2; return(sum*h); }

Hamlet Project

Department of Computer Science

University of Utah