hmt-base-0.20: Haskell Music Theory Base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Math.Histogram

Description

c.f. Statistics.Sample.Histogram (this is much slower but doesn't require any libraries)

Synopsis

Documentation

bHistogram :: Int -> [Double] -> ([(Double, Double)], [Int]) Source #

Calculate histogram on numBins places. Returns the range of each bin and the number of elements in each.

map (snd . bHistogram 10) [[1 .. 10],[1,1,1,2,2,3,10]] == [[1,1,1,1,1,1,1,1,1,1],[3,2,1,0,0,0,0,0,0,1]]

bHistogramRange :: Int -> [Double] -> (Double, Double) Source #

Calculate range.

bHistogramRange 10 (replicate 10 1) == (0.9, 1.1)
bHistogramRange 10 (replicate 10 0) == (-1, 1)
bHistogramRange 10 [1 .. 10] == (0.5, 10.5)
bHistogramRange 25 [1 .. 10] == (0.8125,10.1875)