Commits

Anonymous committed d2e26f6

Entropy instance for UniformDistribution

Comments (0)

Files changed (1)

Statistics/Distribution/Uniform.hs

 instance D.MaybeVariance UniformDistribution where
     maybeStdDev   = Just . D.stdDev
 
+instance D.Entropy UniformDistribution where
+  entropy (UniformDistribution a b) = log (b - a)
+
+instance D.MaybeEntropy UniformDistribution where
+  maybeEntropy = Just . D.entropy
+
 instance D.ContGen UniformDistribution where
     genContVar (UniformDistribution a b) gen = MWC.uniformR (a,b) gen