means

calculate varieties of mean/average using semigroup.

Latest on Hackage:0.1.0.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed by winterland1989

means

Hackage Travis-CI

This package provide following mean calculations using semigroup:

  • Arithmetic/ Weighted Arithmetic mean:

AM

  • Geometric mean:

GM

  • Harmonic mean:

HM

  • Quadratic mean(RMS):

QM

  • Cubic mean:

CM

  • Midrange mean:

MM

Check wikipedia for details.

Example

*Data.Semigroup.Means> getAM . foldr1 (<>) . map am $ [4, 36, 45, 50, 75]
42.0
*Data.Semigroup.Means> getGM . foldr1 (<>) . map gm $ [4, 36, 45, 50, 75]
30.000000000000007
*Data.Semigroup.Means> getHM . foldr1 (<>) . map hm $ [4, 36, 45, 50, 75]
15.0
*Data.Semigroup.Means> :m + Data.Ratio
*Data.Semigroup.Means Data.Ratio> getMM . foldr1 (<>) . map mm $ [4, 36, 45, 50, 75] :: Ratio Int
79 % 2
*Data.Semigroup.Means Data.Ratio> getAM . foldr1 (<>) . map am $ [4, 36, 45, 50, 75] :: Ratio Int
42 % 1

Changes

Revision history for average-semigroup

0.1.0.0 -- YYYY-mm-dd

  • First version. Released on an unsuspecting world.
Depends on:
comments powered byDisqus