NakagamiDistribution
Represents the Nakagami-m distribution, a continuous probability distribution defined on the interval [0, +infinity).
The Nakagami distribution models the magnitude of signals subject to multipath fading and is widely used in wireless communications. If X ~ Nakagami(mu, omega), then X squared follows a Gamma distribution with shape mu and scale omega/mu. When mu = 1 the distribution reduces to Rayleigh, and when mu = 0.5 it reduces to a half-normal.
The CDF is computed via the regularized incomplete gamma function using the Gamma relationship. Quantiles are found using Newton's method with a mean-based initial guess. Random samples are generated by taking the square root of a Gamma variate.
Example:
val dist = NakagamiDistribution(mu = 2.0, omega = 3.0)
dist.mean // 1.6281... (Gamma(mu+0.5)/Gamma(mu) * sqrt(omega/mu))
dist.variance // 0.3493... (omega * (1 - (Gamma(mu+0.5)/Gamma(mu))^2 / mu))
dist.pdf(1.5) // 0.6694... (density at x = 1.5)
dist.cdf(2.0) // 0.7452... (probability of being at most 2)
// Rayleigh as a special case (mu = 1)
val rayleigh = NakagamiDistribution(mu = 1.0, omega = 1.0)Content copied to clipboard