forsyde-atom-0.3.0.0: Shallow-embedded DSL for modeling cyber-physical systems
Copyright(c) George Ungureanu 2020
LicenseBSD-style (see the file LICENSE)
Maintainerugeorge@kth.se
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

ForSyDe.Atom.Prob.Normal

Contents

Description

This module defines recipes for normally distributed random variables, i.e. Gaussian distribution. Wraps utilities imported from Data.Random.Normal.

Synopsis

Recipes

normal Source #

Arguments

:: (Random a, Floating a) 
=> a

standard deviation

-> a

mean

-> Dist a 

Recipe for normally distributed variables.

>>> gen <- getStdGen
>>> let x1 = normal 2 (0.2) :: Dist Float
>>> let x2 = normal 1 (0.5) :: Dist Float
>>> let x3 = normal 2 (0.6) :: Dist Float
>>> let hx = map (histogram 0 3 0.2 . samplesn gen 10000) [x1,x2,x3]
>>> dumpDat $ prepareL defaultCfg hx
Dumped hist1, hist2, hist3 in ./fig
["./fig/hist1.dat","./fig/hist2.dat","./fig/hist3.dat"]

normal' :: (Random a, Floating a) => Dist a Source #

Recipe for normally distributed variables using the default parameters, i.e. mean = 0 and standard deviation = 1.

>>> gen <- getStdGen
>>> let x = normal' :: Dist Float
>>> let hx = histogram (-1) 1 0.2 $ samplesn gen 10000 x
>>> dumpDat $ prepare defaultCfg hx
Dumped hist1 in ./fig
["./fig/hist1.dat"]

Layer

The ForSyDe.Atom.Prob module is re-exported for convenience, so it does not need to be imported explicitly.