Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SuperLib 3.50 - function amvariance() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FUNCTION AMVARIANCE()

  Short:
  ------
  AMVARIANCE() Variance on a given element of multi-dim array


  Returns:
  --------
  <nVariance> => average of array element

  Syntax:
  -------
  AMVARIANCE(aMult,nElem,[bCondition])

  Description:
  ------------
  Returns variance of array <aMult> element <nElem>.
  [bCondition] is an optional codeblock used to select a subset of
  the array. This could be used to filter out 0's or non-numeric
  elements. The block must accept a subarray as a parameter, and
  return  true or false <expL> to determine if this element is
  part of the desired subset. Please note that the codeblock
  accepts the whole subarray, not  just subarray element <nElem>

  Examples:
  ---------

   ?"Total file size here is "
   ??AMSUM(DIRECTORY(),2)

   ?"Total .EXE file size here is "
   ??AMSUM(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

   ?"Variance:"
   ??AMVARIANCE(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

  Notes:
  -------
  Coded by Matthew Maier.

  Presumes all sub-arrays are of equal length

  Source:
  -------
  S_AMSTAT.PRG


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson