Anonymous user
Monte Carlo methods: Difference between revisions
m
→{{header|REXX}}: changed spelling of a variable.
m (→{{header|REXX}}: optimized the inner DO loop.) |
m (→{{header|REXX}}: changed spelling of a variable.) |
||
Line 1,931:
limit=10000 /*REXX random generates only integers. */
limitSq=limit**2 /*··· so, instead of one, use limit**2.*/
!=0; @reps= 'repetitions: Monte Carlo pi is' /*pi decimal digit accuracy (so far).*/
say /*a blank line, just for the eyeballs.*/
Line 1,940:
reps=chunk * j /*calculate the number of repetitions. */
_=compare(4*! / reps, pi) /*compare apples and ··· crabapples. */
if _<=
say right(comma(reps), 20) @reps 'accurate to' _-1 "places." /*─1 ≡ dec. point*/
end /*j*/
exit /*stick a fork in it, we're all done. */
|