# means: calculate varieties of mean/average using semigroup.

[ data, library, mit ] [ Propose Tags ]

calculate varieties of mean/average using semigroup.

Versions [faq] 0.1.0.0 ChangeLog.md base (==4.*), semigroups (>0.18) [details] MIT 2016 Winterland winterland1989 winterland1989@gmail.com Data head: git clone https://github.com/winterland1989/means.git by winterland at Mon Jun 13 04:47:14 UTC 2016 NixOS:0.1.0.0 410 total (9 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs available Last success reported on 2016-06-13

## Modules

[Index]

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

# means

This package provide following mean calculations using semigroup:

• Arithmetic/ Weighted Arithmetic mean:

• Geometric mean:

• Harmonic mean:

• Cubic mean:

• Midrange mean:

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