Skip to main content

Gamma Distribution

Name​

UxHwDoubleGammaDist, UxHwFloatGammaDist — Create a Gamma distribution.

Synopsis​

#include <uxhw.h>

double UxHwDoubleGammaDist(double k, double theta);
float UxHwFloatGammaDist(float k, float theta);

Description​

The UxHwDoubleGammaDist() function, on architectures that associate distributional information with floating-point values, creates a Gamma distribution with parameters k and theta and associates it with its return value. The particle return value is the mean value of a Gamma distribution with parameters k and theta. The probability density function of the Gamma distribution is

{1Γ(k)θkxk−1e−x/θx>0,0x≤0.\begin{cases} \frac{1}{\Gamma(k)\theta^k}x^{k-1}e^{-x/\theta} & x>0, \\ 0 & x \le 0. \end{cases}

Parameters​

  • k ∈(0,∞)\in (0, \infty) — The shape parameter (kk) of the Gamma distribution.
  • theta ∈[0,∞)\in [0, \infty) — The scale parameter (θ\theta) of the Gamma distribution.

Return values​

The UxHwDoubleGammaDist() function returns the mean value of a Gamma distribution with parameters k and theta and associates it with a Gamma distribution with parameters k and theta. If theta = 0 and k > 0, the function returns 00.

Illegal parameter values​

If k <= 0 or theta < 0, the function returns NaN. If k or theta is NaN, the function returns -NaN. See Handling of NaN.

Examples​

#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double value = UxHwDoubleGammaDist(1.0, 3.0);
printf("value = %lf\n", value);

return 0;
}