Averages/Arithmetic mean: Difference between revisions
Content added Content deleted
m (→{{header|dc}}) |
|||
Line 762: | Line 762: | ||
<lang dc>1 2 3 5 7 zsn1k[+z1>+]ds+xln/p |
<lang dc>1 2 3 5 7 zsn1k[+z1>+]ds+xln/p |
||
3.6</lang> |
3.6</lang> |
||
An expanded example, identifying an empty sample set, could be created as a file,e.g., amean.cd: |
|||
<lang dc>[[Nada Mean: ]Ppq]sq |
|||
zd0=qsn [stack length = n]sz |
|||
1k [precision can be altered]sz [+z1<+]ds+x [Sum: ]Pp |
|||
ln/ [Mean: ]Pp [Sample size: ]Plnp</lang> |
|||
By saving the sample set "1 2 3 5 7" in a file (sample.dc), the routine, listing summary information, could be called in a command line: |
|||
<lang dc>$ dc sample.dc amean.cd |
|||
Sum: 18 |
|||
Mean: 3.6 |
|||
Sample size: 5 |
|||
$</lang> |
|||
=={{header|Delphi}}== |
=={{header|Delphi}}== |