Anonymous user
Numerical integration: Difference between revisions
m
→{{header|REXX}}: optimized two subroutines.
m (→{{header|REXX}}: changed wording in the REXX section header, optimized one procedure (about 5% faster).) |
m (→{{header|REXX}}: optimized two subroutines.) |
||
Line 4,286:
=={{header|REXX}}==
Note: there was virtually no difference in accuracy between '''numeric digits 9''' (the default) and '''numeric digits 20'''.
<lang rexx>/*REXX pgm performs numerical integration using
numeric digits 20 /*use twenty decimal digits precision. */
Line 4,295:
if test==4 then do; L= 0; H= 6000; i= 6000000; end
say center('test' test, 79, "═") /*display a header for the test suite. */
say ' left rectangular('L", "H', 'i") ──► " left_rect(L, H, i)
say ' midpoint rectangular('L", "H', 'i") ──► "
say ' right rectangular('L", "H', 'i") ──► " right_rect(L, H, i)
say ' Simpson('L", "H', 'i") ──► " Simpson(L, H, i)
say ' trapezium('L", "H', 'i") ──► " trapezium(L, H, i)
end /*test*/
exit /*stick a fork in it, we're all done. */
Line 4,307:
return arg(1) /* " " "as─is" " */
/*──────────────────────────────────────────────────────────────────────────────────────*/
left_rect:
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
right_rect:
/*──────────────────────────────────────────────────────────────────────────────────────*/
Simpson:
hh=
/*─────────--───────────────────────────────────────────────────────────────────────────*/
trapezium:
{{out|output|text= when using the default inputs:}}
<pre>
|