Rectangle rule
Java Algorithms
numeric integration
Flowchart (ISO 5807)
Source code
class Integral {
static double rect(double a, double b, int n) {
double h = (b - a) / n;
double s = 0;
for (int i = 0; i < n; i++) {
double x = a + i * h;
s = s + x * x * h;
}
return s;
}
}