NegExponential Class Reference

This class simulates a "negative exponential distribution". More...

#include <NegExponential.h>

Inheritance diagram for NegExponential:

RandomVar< double >

List of all members.

Public Member Functions

 NegExponential (double mean=0)
 Creates a new instance of the negative exponential random number generator and initializes the parameter $\lambda$.
 NegExponential (double mean, RNG &r)
 Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter $\lambda$.
double mean () const
 Returns the current value of the parameter $\lambda$ as saved in pMean.
void mean (double newMean)
 Sets the current value of the parameter $\lambda$ as saved in pMean to the new value "newMean".
double operator() (double mean)
 Returns a negative exponential random number for the parameter $\lambda$ (pMean) set to "mean".
double operator() ()
 Returns a negative exponential random number for the parameter $\lambda$ as preset in pMean.
double p (const double &) const
 Returns the probability for the occurrence of random number "x".

Protected Attributes

double pMean


Detailed Description

This class simulates a "negative exponential distribution".

This class is derived from class RandomVar and the uniformally distributed pseudo random number values of the interval (0,1) are transformed to type "double" of the negative exponential distribution (aka exponential distribution), that is given by:

$ f(x) = \lambda \cdot e^{- \lambda x} $

where $x \geq 0$ and $\lambda > 0$.

Below you can see the distribution for the parameter values $\lambda = 1.0$, $\lambda = 2.0$ and $\lambda = 4.0$:

negExp.png

Author:
M. Kreutz
Date:
1995-01-01
Changes:
none
Status:
stable

Constructor & Destructor Documentation

NegExponential::NegExponential ( double  mean = 0  ) 

Creates a new instance of the negative exponential random number generator and initializes the parameter $\lambda$.

Creates a new instance of the negative exponential random number generator and initializes the parameter $\lambda$.

The parameter $\lambda$ that is stored in pMean is initialized by mean.
For this instance, the default pseudo random number generator as member of class RandomVar is used.

Parameters:
mean initial value for pMean (parameter $\lambda$), the default is "0". Notice that mean must be greater than zero, otherwise the methods for returning random numbers or the probability for a random number will always return "0"
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

NegExponential::NegExponential ( double  mean,
RNG r 
)

Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter $\lambda$.

Creates a new neg exponential random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter $\lambda$.

Each instance of a neg exponential random number generator is based on a generator, that is defined in class RNG and returns uniformally pseudo random numbers of the interval (0,1). By default, this is a global generator named RNG::globalRng and included as member in class RandomVar.
Here another pseudo random number generator r is used instead.
Additionally to defining the used pseudo random number generator, pMean (parameter $\lambda$) is initialized by mean.

Parameters:
mean initial value for pMean (parameter $\lambda$). Notice that mean must be greater than zero, otherwise the methods for returning random numbers or the probability for a random number will always return "0"
r the pseudo random number generator that is used
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable


Member Function Documentation

double NegExponential::mean (  )  const [inline]

Returns the current value of the parameter $\lambda$ as saved in pMean.

Returns:
the current value of pMean (parameter $\lambda$)
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

void NegExponential::mean ( double  newMean  )  [inline]

Sets the current value of the parameter $\lambda$ as saved in pMean to the new value "newMean".

Parameters:
newMean value for pMean (parameter $\lambda$), that must be greater than "0", otherwise $\lambda$ will not be changed
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
2002-04-16, ra:
Now the parameter $\lambda$ is checked for being greater than "0"
Status
stable

double NegExponential::operator() ( double  mean  )  [inline]

Returns a negative exponential random number for the parameter $\lambda$ (pMean) set to "mean".

This method performs the inverse transformation of the original uniformally distributed random numbers of the interval (0,1) created by the used pseudo random number generator to the type of the negative exponential distribution.

Parameters:
mean the value for parameter $\lambda$ (pMean), that must be greater than zero, otherwise the random number "0" will be returned
Returns:
the negative exponential random number for $\lambda = \mbox{mean}$ or "0" if mean is less than or equal to zero
Author:
M. Kreutz
Date:
1998-08-17
Changes
2002-04-16, ra:
Now the parameter $\lambda$ is checked for being greater than "0"
Status
stable

double NegExponential::operator() (  )  [virtual]

Returns a negative exponential random number for the parameter $\lambda$ as preset in pMean.

Returns a negative exponential random number for the parameter $\lambda$ as preset in pMean.

Returns:
the negative exponential random number for $\lambda = $ pMean or "0" if pMean is less than or equal to zero
Author:
M. Kreutz
Date:
1995-01-01
Changes
2002-04-16, ra:
Now the parameter $\lambda$ is checked for being greater than "0"
Status
stable

Implements RandomVar< double >.

double NegExponential::p ( const double &  x  )  const [virtual]

Returns the probability for the occurrence of random number "x".

Returns the probability for the occurrence of random number "x".

The probability is returned for the parameter $\lambda$ that is set to pMean.

Parameters:
x the random number for which the probability is returned
Returns:
the probability for the occurrence of random number x or "0" if $x < 0$
Author:
M. Kreutz
Date:
1998-08-17
Changes
2002-04-16, ra:
This method was just a dummy method before. Now it really returns the probability.
Status
stable

Implements RandomVar< double >.


Member Data Documentation

double NegExponential::pMean [protected]

The parameter $\lambda$ in the distribution function (see class description for details).


The documentation for this class was generated from the following files:

Generated on Thu Aug 28 18:34:50 2008 for Dolphin by  doxygen 1.5.6