#include <phrand.h>
Inheritance diagram for simth::ExponentialMaxLimitRng:
Public Member Functions | |
ExponentialMaxLimitRng (double lambda, double Tmax) | |
virtual | ~ExponentialMaxLimitRng () |
virtual double | get () const |
double | attenuationFactor () const |
double | maxLimit () const |
With given attenuation and an upper interval bound the probability density function (pdf) of this random variable will be
The attenuation lambda and the upper interval bound T are given as constructor parameters.
For this truncated exponential, the mean value is
(note the positive exponent in the denominator) and the variance is
The cumulative distribution function (CDF) is
This PDF of a truncated exponential will approximately come close to the usual non-truncated exponential if the upper interval bound T is greater than roughly 6.5 times the mean value, i.e. if the condition holds. This bound is derived by calculating how much greater T must be compared to , so that the second term of the mean value is smaller than a given fraction of the first term. The required multiple turns out to be calculated by the -1th branch of Lambert's W function of the precision, e.g. for 0.01 in Matlab -lambert
(-1,-0.01)
If this condition is met, the usual formulas for the exponential distribution will hold: The probability density function (pdf) is for and elsewhere, the mean value is , and the variance is .
WATCH OUT: The constructor takes the attenuation as an argument, not the mean value. Even in earlier versions, when the documentation errornously said it would take the mean, it still took the attenuation. Please make really sure you understand that you have to specify the attenuation here and not the mean.
This RNG simply uses a uniform RNG from the GSL, and takes this as input to the inverse cumulative distribution function (CDF) of the truncated exponential CDF. This means if is a [0,1[-uniform random variable, the truncated exponential random variable is calculated as
Previously it was stated here that the 'maximally equidistributed combined Tausworthe generator by L'Ecuyer' is used to generator the random output. (See GSL reference manual for further information).
|
Class constructor with attenuation factor 'lambda' and maximal generated value 'T'.
|
|
Destructor |
|
Returns a random variate with the described exponential distribution. Implements simth::RandomGenerator. |
|
Attenuation factor (lambda) of the distribution (approx. = 1/mean). |
|
|