|
"Distribution Functions" |
|
Exponential Distribution Method |
|
Exponential Distribution Results |
|
IMPLEMENTATION
Exponential Distribution Method
The Exponential distribution is used to model events that occur randomly over time. In particular, this distribution
is very powerful for studying lifetimes.
Probability Density Function
The probability density function of the exponential distribution is presented in the following formula:
where ç > 0 is a parameter of the distribution, often called the rate parameter. This distribution is defined in
the range 0 ≤ x < ∞
Exponential Random Number Generator
The random numbers from the exponential variate exp(ç), (code not shown nor discussed), with the relationship:
exp(ç) ≈ - 1 / ç ln u(0,1)
|
Testing the Exponential Distribution Method
To test the Exponential Distribution method, a new static method has been added. The TestExponentialDistribution() method has
been written and executed. No additional code is shown. The user can change variables as desired.
For the test, two parameters were set:
number of bins = 20; (nBins)
number of points = 2000; (nPoints)
|
where the parameter (nBins) is the number of bins in the histogram and (nPoints)
is the number of random points. A random array is created using the exponential distribution. A comparison is made between
the histogram of random data and the theoretical probability density function of the exponential distribution. One can see the
results from the exponential random generator are very close to the theoretical exponential distribution function.
Running this example generates the results shown above.
static void TestExponentialDistribution();
{
for (int i = 0; i < nBins; i++)
{
ListBox1.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Random Data = " + ydata[i] + "," + " - - - - -> Density Distribution = " + Math.Round(ydistribution[i] * normalizeFactor, 0).ToString());
}
}
|
|
|
|