Skip to main content

Log-normal Distribution

Name

UxHwDoubleLognormalDist, UxHwFloatLognormalDist Create a Log-normal distribution.

Synopsis

#include <uxhw.h>

double UxHwDoubleLognormalDist(double mu, double sigma);
float UxHwFloatLognormalDist(float mu, float sigma);

Description

The UxHwDoubleLognormalDist() function, on architectures that associate distributional information with floating-point values, creates a Log-normal distribution with parameters mu and sigma and associates it with its return value. The particle return value is the mean value of a Log-normal distribution with parameters mu and sigma. The probability density function of the Log-normal distribution is

f(x;μ,σ)=1xσ2πexp[(lnxμ)22σ2].f(x;\mu,\sigma)=\frac{1}{x\sigma\sqrt{2\pi}}\exp\left[-\frac{\left(\ln x-\mu\right)^{2}}{2\sigma^{2}}\right].

Parameters

  • mu (,)\in (-\infty, \infty) The logarithm of the scale parameter (μ\mu).
  • sigma [0,)\in [0, \infty) The standard deviation (σ\sigma) of the underlying normal distribution.

Return Values

The UxHwDoubleLognormalDist() function returns the mean of samples of a Log-normal distribution with parameters mu and sigma. If sigma < 0, the function returns NaN.

  Examples

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

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

return 0;
}