Averages/Arithmetic mean: Difference between revisions

Content added Content deleted
Line 3,219: Line 3,219:
The dot product of any vector with [1 1 ... 1] gives the sum of its elements.
The dot product of any vector with [1 1 ... 1] gives the sum of its elements.
≪ SIZE LAST DUP 1 CON DOT SWAP / ≫
≪ SIZE LAST DUP 1 CON DOT SWAP / ≫
'AMEAN' STO

===Using built-in statistics features===
Most of the code is dedicated to store the input array according to built-in statistics requirements, which requires a matrix with one line per record. Main benefit of this approach is that you can then easily calculate standard deviation and variance by calling resp. <code>SDEV</code> and <code>VAR</code> functions.
≪ { 1 } OVER SIZE + RDM TRN '∑DAT' STO MEAN ≫
'AMEAN' STO
'AMEAN' STO