{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
module Statistics.Distribution.CauchyLorentz (
CauchyDistribution
, cauchyDistribMedian
, cauchyDistribScale
, cauchyDistribution
, cauchyDistributionE
, standardCauchy
) where
import Control.Applicative
import Data.Aeson (FromJSON(..), ToJSON, Value(..), (.:))
import Data.Binary (Binary(..))
import Data.Maybe (fromMaybe)
import Data.Data (Data, Typeable)
import GHC.Generics (Generic)
import qualified Statistics.Distribution as D
import Statistics.Internal
data CauchyDistribution = CD {
CauchyDistribution -> Double
cauchyDistribMedian :: {-# UNPACK #-} !Double
, CauchyDistribution -> Double
cauchyDistribScale :: {-# UNPACK #-} !Double
}
deriving (CauchyDistribution -> CauchyDistribution -> Bool
(CauchyDistribution -> CauchyDistribution -> Bool)
-> (CauchyDistribution -> CauchyDistribution -> Bool)
-> Eq CauchyDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CauchyDistribution -> CauchyDistribution -> Bool
$c/= :: CauchyDistribution -> CauchyDistribution -> Bool
== :: CauchyDistribution -> CauchyDistribution -> Bool
$c== :: CauchyDistribution -> CauchyDistribution -> Bool
Eq, Typeable, Typeable CauchyDistribution
DataType
Constr
Typeable CauchyDistribution
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CauchyDistribution
-> c CauchyDistribution)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CauchyDistribution)
-> (CauchyDistribution -> Constr)
-> (CauchyDistribution -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CauchyDistribution))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CauchyDistribution))
-> ((forall b. Data b => b -> b)
-> CauchyDistribution -> CauchyDistribution)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r)
-> (forall u.
(forall d. Data d => d -> u) -> CauchyDistribution -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> CauchyDistribution -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution)
-> Data CauchyDistribution
CauchyDistribution -> DataType
CauchyDistribution -> Constr
(forall b. Data b => b -> b)
-> CauchyDistribution -> CauchyDistribution
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CauchyDistribution
-> c CauchyDistribution
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CauchyDistribution
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> CauchyDistribution -> u
forall u. (forall d. Data d => d -> u) -> CauchyDistribution -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CauchyDistribution
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CauchyDistribution
-> c CauchyDistribution
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CauchyDistribution)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CauchyDistribution)
$cCD :: Constr
$tCauchyDistribution :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
gmapMp :: (forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
gmapM :: (forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CauchyDistribution -> m CauchyDistribution
gmapQi :: Int -> (forall d. Data d => d -> u) -> CauchyDistribution -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CauchyDistribution -> u
gmapQ :: (forall d. Data d => d -> u) -> CauchyDistribution -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CauchyDistribution -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CauchyDistribution -> r
gmapT :: (forall b. Data b => b -> b)
-> CauchyDistribution -> CauchyDistribution
$cgmapT :: (forall b. Data b => b -> b)
-> CauchyDistribution -> CauchyDistribution
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CauchyDistribution)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CauchyDistribution)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CauchyDistribution)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CauchyDistribution)
dataTypeOf :: CauchyDistribution -> DataType
$cdataTypeOf :: CauchyDistribution -> DataType
toConstr :: CauchyDistribution -> Constr
$ctoConstr :: CauchyDistribution -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CauchyDistribution
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CauchyDistribution
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CauchyDistribution
-> c CauchyDistribution
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CauchyDistribution
-> c CauchyDistribution
$cp1Data :: Typeable CauchyDistribution
Data, (forall x. CauchyDistribution -> Rep CauchyDistribution x)
-> (forall x. Rep CauchyDistribution x -> CauchyDistribution)
-> Generic CauchyDistribution
forall x. Rep CauchyDistribution x -> CauchyDistribution
forall x. CauchyDistribution -> Rep CauchyDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CauchyDistribution x -> CauchyDistribution
$cfrom :: forall x. CauchyDistribution -> Rep CauchyDistribution x
Generic)
instance Show CauchyDistribution where
showsPrec :: Int -> CauchyDistribution -> ShowS
showsPrec Int
i (CD Double
m Double
s) = String -> Double -> Double -> Int -> ShowS
forall a b. (Show a, Show b) => String -> a -> b -> Int -> ShowS
defaultShow2 String
"cauchyDistribution" Double
m Double
s Int
i
instance Read CauchyDistribution where
readPrec :: ReadPrec CauchyDistribution
readPrec = String
-> (Double -> Double -> Maybe CauchyDistribution)
-> ReadPrec CauchyDistribution
forall a b r.
(Read a, Read b) =>
String -> (a -> b -> Maybe r) -> ReadPrec r
defaultReadPrecM2 String
"cauchyDistribution" Double -> Double -> Maybe CauchyDistribution
cauchyDistributionE
instance ToJSON CauchyDistribution
instance FromJSON CauchyDistribution where
parseJSON :: Value -> Parser CauchyDistribution
parseJSON (Object Object
v) = do
Double
m <- Object
v Object -> Key -> Parser Double
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"cauchyDistribMedian"
Double
s <- Object
v Object -> Key -> Parser Double
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"cauchyDistribScale"
Parser CauchyDistribution
-> (CauchyDistribution -> Parser CauchyDistribution)
-> Maybe CauchyDistribution
-> Parser CauchyDistribution
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Parser CauchyDistribution
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser CauchyDistribution)
-> String -> Parser CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> String
errMsg Double
m Double
s) CauchyDistribution -> Parser CauchyDistribution
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe CauchyDistribution -> Parser CauchyDistribution)
-> Maybe CauchyDistribution -> Parser CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Maybe CauchyDistribution
cauchyDistributionE Double
m Double
s
parseJSON Value
_ = Parser CauchyDistribution
forall (f :: * -> *) a. Alternative f => f a
empty
instance Binary CauchyDistribution where
put :: CauchyDistribution -> Put
put (CD Double
m Double
s) = Double -> Put
forall t. Binary t => t -> Put
put Double
m Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Double -> Put
forall t. Binary t => t -> Put
put Double
s
get :: Get CauchyDistribution
get = do
Double
m <- Get Double
forall t. Binary t => Get t
get
Double
s <- Get Double
forall t. Binary t => Get t
get
Get CauchyDistribution
-> (CauchyDistribution -> Get CauchyDistribution)
-> Maybe CauchyDistribution
-> Get CauchyDistribution
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Get CauchyDistribution
forall a. HasCallStack => String -> a
error (String -> Get CauchyDistribution)
-> String -> Get CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> String
errMsg Double
m Double
s) CauchyDistribution -> Get CauchyDistribution
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe CauchyDistribution -> Get CauchyDistribution)
-> Maybe CauchyDistribution -> Get CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Maybe CauchyDistribution
cauchyDistributionE Double
m Double
s
cauchyDistribution :: Double
-> Double
-> CauchyDistribution
cauchyDistribution :: Double -> Double -> CauchyDistribution
cauchyDistribution Double
m Double
s
= CauchyDistribution
-> Maybe CauchyDistribution -> CauchyDistribution
forall a. a -> Maybe a -> a
fromMaybe (String -> CauchyDistribution
forall a. HasCallStack => String -> a
error (String -> CauchyDistribution) -> String -> CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> String
errMsg Double
m Double
s)
(Maybe CauchyDistribution -> CauchyDistribution)
-> Maybe CauchyDistribution -> CauchyDistribution
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Maybe CauchyDistribution
cauchyDistributionE Double
m Double
s
cauchyDistributionE :: Double
-> Double
-> Maybe CauchyDistribution
cauchyDistributionE :: Double -> Double -> Maybe CauchyDistribution
cauchyDistributionE Double
m Double
s
| Double
s Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
0 = CauchyDistribution -> Maybe CauchyDistribution
forall a. a -> Maybe a
Just (Double -> Double -> CauchyDistribution
CD Double
m Double
s)
| Bool
otherwise = Maybe CauchyDistribution
forall a. Maybe a
Nothing
errMsg :: Double -> Double -> String
errMsg :: Double -> Double -> String
errMsg Double
_ Double
s
= String
"Statistics.Distribution.CauchyLorentz.cauchyDistribution: FWHM must be positive. Got "
String -> ShowS
forall a. [a] -> [a] -> [a]
++ Double -> String
forall a. Show a => a -> String
show Double
s
standardCauchy :: CauchyDistribution
standardCauchy :: CauchyDistribution
standardCauchy = Double -> Double -> CauchyDistribution
CD Double
0 Double
1
instance D.Distribution CauchyDistribution where
cumulative :: CauchyDistribution -> Double -> Double
cumulative (CD Double
m Double
s) Double
x
| Double
y Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< -Double
1 = Double -> Double
forall a. Floating a => a -> a
atan (-Double
1Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
y) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
forall a. Floating a => a
pi
| Bool
otherwise = Double
0.5 Double -> Double -> Double
forall a. Num a => a -> a -> a
+ Double -> Double
forall a. Floating a => a -> a
atan Double
y Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
forall a. Floating a => a
pi
where
y :: Double
y = (Double
x Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
m) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
s
complCumulative :: CauchyDistribution -> Double -> Double
complCumulative (CD Double
m Double
s) Double
x
| Double
y Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
1 = Double -> Double
forall a. Floating a => a -> a
atan (Double
1Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
y) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
forall a. Floating a => a
pi
| Bool
otherwise = Double
0.5 Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double -> Double
forall a. Floating a => a -> a
atan Double
y Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
forall a. Floating a => a
pi
where
y :: Double
y = (Double
x Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
m) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
s
instance D.ContDistr CauchyDistribution where
density :: CauchyDistribution -> Double -> Double
density (CD Double
m Double
s) Double
x = (Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
forall a. Floating a => a
pi) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ (Double
s Double -> Double -> Double
forall a. Num a => a -> a -> a
* (Double
1 Double -> Double -> Double
forall a. Num a => a -> a -> a
+ Double
yDouble -> Double -> Double
forall a. Num a => a -> a -> a
*Double
y))
where y :: Double
y = (Double
x Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
m) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
s
quantile :: CauchyDistribution -> Double -> Double
quantile (CD Double
m Double
s) Double
p
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
0 = -Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
1 = Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
0.5 = Double
m
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
0 = Double
forall a. a
err
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
0.5 = Double
m Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
s Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double -> Double
forall a. Floating a => a -> a
tan( Double
forall a. Floating a => a
pi Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
p )
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
1 = Double
m Double -> Double -> Double
forall a. Num a => a -> a -> a
+ Double
s Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double -> Double
forall a. Floating a => a -> a
tan( Double
forall a. Floating a => a
pi Double -> Double -> Double
forall a. Num a => a -> a -> a
* (Double
1 Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
p) )
| Bool
otherwise = Double
forall a. a
err
where
err :: a
err = String -> a
forall a. HasCallStack => String -> a
error
(String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$ String
"Statistics.Distribution.CauchyLorentz.quantile: p must be in [0,1] range. Got: "String -> ShowS
forall a. [a] -> [a] -> [a]
++Double -> String
forall a. Show a => a -> String
show Double
p
complQuantile :: CauchyDistribution -> Double -> Double
complQuantile (CD Double
m Double
s) Double
p
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
0 = Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
1 = -Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0
| Double
p Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
== Double
0.5 = Double
m
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
0 = Double
forall a. a
err
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
0.5 = Double
m Double -> Double -> Double
forall a. Num a => a -> a -> a
+ Double
s Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double -> Double
forall a. Floating a => a -> a
tan( Double
forall a. Floating a => a
pi Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
p )
| Double
p Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
1 = Double
m Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
s Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double -> Double
forall a. Floating a => a -> a
tan( Double
forall a. Floating a => a
pi Double -> Double -> Double
forall a. Num a => a -> a -> a
* (Double
1 Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double
p) )
| Bool
otherwise = Double
forall a. a
err
where
err :: a
err = String -> a
forall a. HasCallStack => String -> a
error
(String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$ String
"Statistics.Distribution.CauchyLorentz.quantile: p must be in [0,1] range. Got: "String -> ShowS
forall a. [a] -> [a] -> [a]
++Double -> String
forall a. Show a => a -> String
show Double
p
instance D.ContGen CauchyDistribution where
genContVar :: CauchyDistribution -> g -> m Double
genContVar = CauchyDistribution -> g -> m Double
forall d g (m :: * -> *).
(ContDistr d, StatefulGen g m) =>
d -> g -> m Double
D.genContinuous
instance D.Entropy CauchyDistribution where
entropy :: CauchyDistribution -> Double
entropy (CD Double
_ Double
s) = Double -> Double
forall a. Floating a => a -> a
log Double
s Double -> Double -> Double
forall a. Num a => a -> a -> a
+ Double -> Double
forall a. Floating a => a -> a
log (Double
4Double -> Double -> Double
forall a. Num a => a -> a -> a
*Double
forall a. Floating a => a
pi)
instance D.MaybeEntropy CauchyDistribution where
maybeEntropy :: CauchyDistribution -> Maybe Double
maybeEntropy = Double -> Maybe Double
forall a. a -> Maybe a
Just (Double -> Maybe Double)
-> (CauchyDistribution -> Double)
-> CauchyDistribution
-> Maybe Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CauchyDistribution -> Double
forall d. Entropy d => d -> Double
D.entropy