function result = midpoint0(integrand, a, b, N)
dx = (b - a)/N;
result = 0;
for x = (a + dx*( (1:N) - 0.5 ))
   result = result + integrand(x);
end
result = result * dx; % only one multiplication this way!
