function R = rectangle_int(f, a, b, n) R = ((b-a)/n) * sum(f(a+([0:n-1]+1/2)*((b-a)/n))) end;