Numerical integration: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: update to new testing regime |
→{{header|ALGOL 68}}: fix right rect to go all the way to b, not b-h |
||
Line 188: | Line 188: | ||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
{{incorrect|ALGOL 68|right rect stops one h too soon; mid rect doesn't sample at midpoints but merely recreates trapezium differently.}} |
|||
<lang algol68>MODE F = PROC(LONG REAL)LONG REAL; |
<lang algol68>MODE F = PROC(LONG REAL)LONG REAL; |
||
Line 216: | Line 215: | ||
LONG REAL sum:= 0; |
LONG REAL sum:= 0; |
||
LONG REAL x:= a + h; |
LONG REAL x:= a + h; |
||
WHILE x <= b |
WHILE x <= b DO |
||
sum := sum + (h * f(x)); |
sum := sum + (h * f(x)); |
||
x +:= h |
x +:= h |