Jump to content

Averages/Arithmetic mean: Difference between revisions

Line 3,219:
The dot product of any vector with [1 1 ... 1] gives the sum of its elements.
≪ 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
 
1,151

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.