# Changeset 2889

Ignore:
Timestamp:
Dec 7, 2012, 9:06:07 AM (9 years ago)
Message:

Binomial distribution. fixes #730

Location:
trunk
Files:
3 edited

### Legend:

Unmodified
 r2838 void clone(const gsl_rng&); }; // --------------------- Discrete distribtuions --------------------- /// virtual unsigned long operator()(void) const = 0; protected: /// GSL random gererator }; /** \brief Binomial distribution \see gsl_ran_binomial \since New in yat 0.10 */ class Binomial : Discrete { public: /** \brief Constructor Create an object that generates random numbers from binomial distribution, the number of successes in \n trials each with success probability \a p. */ Binomial(double p, unsigned int n); /** \return number from binomial distrubtion as parametrized in constructor. */ unsigned long operator()(void) const; private: double p_; unsigned int n_; }; /// /// @brief General /// class DiscreteGeneral : public Discrete class DiscreteGeneral : public Discrete { public: /// explicit DiscreteGeneral(const statistics::Histogram& hist); /** \brief Copy constructor /** @brief Discrete uniform distribution Discrete uniform distribution also known as the "equally likely outcomes" distribution. Each outcome, in this case an integer from [0,n-1] , have equal probability to occur. Distribution function \f$p(k) = \frac{1}{n+1} \f$ for \f$0 \le k < n \f$ \n Expectation value: \f$\frac{n-1}{2} \f$ \n k < n \f$\n Expectation value: \f$ \frac{n-1}{2} \f$\n Variance: \f$ \frac{1}{12}(n-1)(n+1) \f$*/ class DiscreteUniform : public Discrete, class DiscreteUniform : public Discrete, public std::unary_function { /** @brief Poisson Distribution Having a Poisson process (i.e. no memory), number of occurences within a given time window is Poisson distributed. This succesful is small (in such a way that the expected number of succesful attempts is \f$ m \f$. Probability function \f$ p(k) = e^{-m}\frac{m^k}{k!} \f$for \f$ 0 \le k  \f$\n Expectation value: \f$ m \f$\n k \f$ \n Expectation value: \f$m \f$ \n Variance: \f$m \f$ */ \brief Generator of random numbers from an exponential distribution. The distribution function is \f$f(x) = \frac{1}{m}\exp(-x/a) \f$ for \f$x \f$ with the expectation value \f$m \f$ and /** @brief Gaussian distribution Class for generating a random number from a Gaussian distribution between zero and unity. Utilizes the Box-Muller algorithm, which needs two calls to random generator. Distribution function \f\$ f(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp(-\frac{(x-\mu)^2}{2\sigma^2})