Numerical integration: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: corrected formatting tags)
m (→‎{{header|Perl 6}}: moved commentary to top, fixed language version tag)
Line 3,340: Line 3,340:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
The addition of <tt>'''Promise'''</tt>/<tt>'''await'''</tt>, in two places, allows for concurrent computation, and brings a significant speed-up in running time. Which is not to say that it makes this code fast, but it does make it less slow.
The addition of <tt>'''Promise'''</tt>/<tt>'''await'''</tt> allows for concurrent computation, and brings a significant speed-up in running time. Which is not to say that it makes this code fast, but it does make it less slow.

{{works with|rakudo|2018-09}}
Note that these integrations are done with rationals rather than floats, so should be fairly precise (though of course with so few iterations they are not terribly accurate (except when they are)). Some of the sums do overflow into <tt>Num</tt> (floating point)--currently Rakudo allows 64-bit denominators--but at least all of the interval arithmetic is exact.
{{works with|Rakudo|2018.09}}

<lang perl6>use MONKEY-SEE-NO-EVAL;
<lang perl6>use MONKEY-SEE-NO-EVAL;


Line 3,437: Line 3,440:
composite trapezoidal rule: 18000000
composite trapezoidal rule: 18000000
quadratic simpsons rule: 18000000</pre>
quadratic simpsons rule: 18000000</pre>

Note that these integrations are done with rationals rather than floats, so should be fairly precise (though of course with so few iterations they are not terribly accurate (except when they are)). Some of the sums do overflow into <tt>Num</tt> (floating point)--currently Rakudo allows 64-bit denominators--but at least all of the interval arithmetic is exact.


=={{header|Phix}}==
=={{header|Phix}}==