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 an Gamma distribution with parameters k and theta. The probability density function of the Gamma distribution is

f(x;k,θ)={1Γ(k)θkxk1ex/θx>0,0x0.f(x;k,\theta)= \begin{cases} \frac{1}{\Gamma(k)\theta^k}x^{k-1}e^{-x/\theta} & x>0, \\ 0 & x \le 0. \end{cases}

Parameters

  • k The shape parameter (kk) of the Gamma distribution.
  • theta The scale parameter (θ\theta) of the Gamma distribution.

Return Values

The UxHwDoubleGammaDist() function returns the mean of samples of a Gamma distribution with parameter k. If k <= 0, the function returns NaN. If theta < 0, the function returns NaN. If theta = 0, the function returns 0.

  Examples

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

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

return 0;
}