Numerical integration: Difference between revisions

Content added Content deleted
(→‎{{header|ALGOL 68}}: fix right rect to go all the way to b, not b-h)
(→‎{{header|ALGOL 68}}: fixed mid rect, which was still wrong, sigh)
Line 232: Line 232:
LONG REAL x:= a;
LONG REAL x:= a;
WHILE x <= b - h DO
WHILE x <= b - h DO
sum := sum + (h / 2) * (f(x) + f(x + h));
sum := sum + h * f(x + h / 2);
x +:= h
x +:= h
OD;
OD;