Class prob_dens_gaussian (o2scl)

O2scl : Class List

class o2scl::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

prob_dens_gaussian()

Create a standard normal distribution.

prob_dens_gaussian(double cent, double sigma)

Create a Gaussian distribution with width sigma.

The value of sigma must be larger than zero.

~prob_dens_gaussian()
prob_dens_gaussian(const prob_dens_gaussian &pdg)

Copy constructor.

prob_dens_gaussian &operator=(const prob_dens_gaussian &pdg)

Copy constructor with operator=.

void set_seed(unsigned long int s)

Set the seed.

void set_center(double cent)

Set the center.

void set_sigma(double sigma)

Set the Gaussian width (must be positive)

double mean()

Get the center.

double stddev()

Get the Gaussian width.

double operator()() const

Sample from the specified density.

double pdf(double x) const

The normalized density.

double log_pdf(double x) const

The log of the normalized density.

double cdf(double x) const

The cumulative distribution function (from the lower tail)

double invert_cdf(double in_cdf) const

The inverse cumulative distribution function.

double entropy() const

Entropy of the distribution ( \( - \int f \ln f \) )

Protected Attributes

double cent_

Central value.

double sigma_

Width parameter.

A value of -1 indicates it is yet unspecified.

o2scl::rng_gsl r

Base GSL random number generator.