Class prob_dens_gaussian (o2scl)¶
-
class prob_dens_gaussian : public o2scl::prob_dens_func¶
A one-dimensional Gaussian probability density.
The distribution
\[ P(x)=\frac{1}{\sigma \sqrt{2 \pi}} e^{-\frac{\left(x-x_0\right)^2}{2\sigma^2}} \]This class is experimental.
Public Functions
-
inline prob_dens_gaussian()¶
Create a standard normal distribution.
-
inline prob_dens_gaussian(double cent, double sigma)¶
Create a Gaussian distribution with width
sigma
.The value of
sigma
must be larger than zero.
-
inline virtual ~prob_dens_gaussian()¶
-
inline prob_dens_gaussian(const prob_dens_gaussian &pdg)¶
Copy constructor.
-
inline prob_dens_gaussian &operator=(const prob_dens_gaussian &pdg)¶
Copy constructor with operator=.
-
inline void set_seed(unsigned long int s)¶
Set the seed.
-
inline void set_center(double cent)¶
Set the center.
-
inline void set_sigma(double sigma)¶
Set the Gaussian width (must be positive)
-
inline double mean()¶
Get the center.
-
inline double stddev()¶
Get the Gaussian width.
-
inline virtual double operator()() const¶
Sample from the specified density.
-
inline virtual double pdf(double x) const¶
The normalized density.
-
inline virtual double log_pdf(double x) const¶
The log of the normalized density.
-
inline virtual double cdf(double x) const¶
The cumulative distribution function (from the lower tail)
-
inline virtual double invert_cdf(double in_cdf) const¶
The inverse cumulative distribution function.
-
inline virtual double entropy() const¶
Entropy of the distribution ( \( - \int f \ln f \) )
-
inline prob_dens_gaussian()¶