Anonymous user
Statistics/Basic: Difference between revisions
m
→{{header|REXX}}: added/changed comments and whitespace, used templates for the OUTPUTs, simplified some parts of the program, expanded the width of the histograms (bars).
m (→{{header|REXX}}: added/changed comments and whitespace, used templates for the OUTPUTs, simplified some parts of the program, expanded the width of the histograms (bars).) |
|||
Line 3,278:
@.j=random(0, 99999) / 100000 /*express random number as a fraction. */
_=substr(@.j'00', 3, 1) /*determine which bin the number is in,*/
#._=#._ +
end /*j*/
say
say 'sample size = ' size; say
Line 3,293:
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
mean:
stdDev:
/*──────────────────────────────────────────────────────────────────────────────────────*/
sqrt: procedure; parse arg x; if x=0 then return 0; d=digits(); m.=9; numeric form; h=d+6
numeric digits; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g=g*.5'e'_ % 2
▲'''output''' when using the default input of: <tt> 100 </tt>
<pre>
0 ──►0.1 12.00
0.1──►0.2
0.2──►0.3
0.3──►0.4
0.4──►0.5
0.5──►0.6
0.6──►0.7
0.7──►0.8
0.8──►0.9
0.9──►1
sample size = 100
mean = 0.
stdDev = 0.
</pre>
<pre>
0 ──►0.1
0.1──►0.2
0.2──►0.3
0.3──►0.4
0.4──►0.5
0.5──►0.6
0.6──►0.7 10.
0.7──►0.8
0.8──►0.9
0.9──►1 10.
sample size = 1000
mean = 0.
stdDev = 0.
</pre>
<pre>
0 ──►0.1
0.1──►0.2
0.2──►0.3
0.3──►0.4
0.4──►0.5 9.
0.5──►0.6 10.
0.6──►0.7 10.
0.7──►0.8
0.8──►0.9 9.
0.9──►1
sample size = 10000
mean = 0.
stdDev = 0.
</pre>
<pre>
0 ──►0.1 10.
0.1──►0.2
0.2──►0.3 9.
0.3──►0.4
0.4──►0.5
0.5──►0.6 10.
0.6──►0.7
0.7──►0.8
0.8──►0.9 10.
0.9──►1 9.
sample size = 100000
mean = 0.
stdDev = 0.
</pre>
<pre>
0 ──►0.1 9.
0.1──►0.2 10.
0.2──►0.3
0.3──►0.4 9.
0.4──►0.5 10.
0.5──►0.6 10.
0.6──►0.7 9.
0.7──►0.8 10.03
0.8──►0.9 9.
0.9──►1 9.99
sample size = 1000000
mean = 0.
stdDev = 0.
</pre>
|