Statistics/Basic: Difference between revisions
Content added Content deleted
(Added Applesoft BASIC, Chipmunk Basic, GW-BASIC, MSX Basic and QBasic) |
(add RPL) |
||
Line 4,465: | Line 4,465: | ||
9 |
9 |
||
********************************************************************* |
********************************************************************* |
||
</pre> |
|||
=={{header|RPL}}== |
|||
Built-in statistics functions in RPL relies on a specific array named <code>∑DAT</code>, which is automatically generated when the first record is created by the word <code>∑+</code>. |
|||
{{works with|Halcyon Calc|4.2.8}} |
|||
{| class="wikitable" |
|||
! RPL code |
|||
! Comment |
|||
|- |
|||
| |
|||
≪ |
|||
CL∑ 1 n '''START''' RAND ∑+ '''NEXT''' |
|||
MEAN SDEV |
|||
{ 10 } 0 CON |
|||
1 n '''FOR''' j |
|||
∑DAT j { 1 } + GET |
|||
10 * 1 + FLOOR DUP2 GET 1 + PUT |
|||
'''NEXT''' |
|||
{ } 1 10 '''FOR''' j |
|||
OVER j GET 3 PICK RNRM / 20 * |
|||
"0." j 1 - →STR + "= " + 1 ROT '''START''' "*" + '''NEXT''' + |
|||
'''NEXT''' |
|||
≫ ≫ ‘<span style="color:blue">TASK</span>’ STO |
|||
| |
|||
<span style="color:blue">TASK</span> ''( #samples → statistics... ) '' |
|||
Generate and store samples in the statistics database |
|||
The easy part of the task |
|||
Create a 10-cell vector |
|||
Scan the database |
|||
Read the nth record |
|||
Increment the related cell |
|||
Generate histogramme |
|||
RNRM returns the max value of the 10-cell vector |
|||
|} |
|||
1000 <span style="color:blue">TASK</span> |
|||
{{out}} |
|||
<pre> |
|||
4: 0.492756012687 |
|||
3: 0.29333176137 |
|||
2: [ 120 100 90 86 112 113 90 87 97 105 ] |
|||
1: { "0.0= ********************" |
|||
"0.1= ****************" |
|||
"0.2= ***************" |
|||
"0.3= **************" |
|||
"0.4= ******************" |
|||
"0.5= ******************" |
|||
"0.6= ***************" |
|||
"0.7= **************" |
|||
"0.8= ****************" |
|||
"0.9= *****************" } |
|||
</pre> |
</pre> |
||