2.2.5.9. Exponential law
This law describes an exponential with a rate parameter \(\lambda\) and a minimum \(x_{\rm min}\), as
The rate parameter \(\lambda\) should be greater than 0.0001.
Uranie code to simulate an Exponential random variable is:
TDataServer *tds = new TDataServer("tdssampler", "Sampler Uranie demo");
tds->addAttribute( new TExponentialDistribution("exp", 0.5));
TSampling *fsamp = new TSampling(tds, "lhs", 300);
fsamp->generateSample(); // Create a representative sample
tds->Draw("exp");
Figure 2.15 shows the PDF, CDF and inverse CDF generated for different sets of parameters.
Figure 2.15 Example of PDF, CDF and inverse CDF for Exponential distributions.
Is it also possible to set boundaries to the infinite span of this distribution to create a truncated Exponential law. This can be done by calling the following method:
tds->getAttribute("exp")->setBounds(0.4,6.0); //truncate the law
The resulting PDF, CDF and inverse CDF, with and without truncation, can be seen, in this case, in Figure 2.16 for a given set of parameters and various boundaries.
Figure 2.16 Example of PDF, CDF and inverse CDF for a Exponential truncated distribution.