diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/README.md index f701be2d345d..a2daf53d012c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/README.md @@ -116,7 +116,8 @@ y = mypdf( 2.0 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var EPS = require( '@stdlib/constants/float64/eps' ); var pdf = require( '@stdlib/stats/base/dists/lognormal/pdf' ); var sigma; @@ -126,9 +127,9 @@ var y; var i; for ( i = 0; i < 10; i++ ) { - x = randu() * 10.0; - mu = (randu() * 10.0) - 5.0; - sigma = randu() * 20.0; + x = uniform( 0.1, 10.0 ); + mu = uniform( -5.0, 5.0 ); + sigma = uniform( EPS, 5.0 ); y = pdf( x, mu, sigma ); console.log( 'x: %d, µ: %d, σ: %d, f(x;µ,σ): %d', x.toFixed( 4 ), mu.toFixed( 4 ), sigma.toFixed( 4 ), y.toFixed( 4 ) ); } @@ -138,6 +139,105 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/lognormal/pdf.h" +``` + +#### stdlib_base_dists_lognormal_pdf( x, mu, sigma ) + +Evaluates the [probability density function][pdf] (PDF) of a [lognormal][lognormal-distribution] distribution with parameters input value `x`, location parameter `mu` and scale parameter `sigma`. + +```c +double y = stdlib_base_dists_lognormal_pdf( 2.0, 0.0, 1.0 ); +// returns ~0.157 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **mu**: `[in] double` location parameter. +- **sigma**: `[in] double` scale parameter. + +```c +double stdlib_base_dists_lognormal_pdf( const double x, const double mu, const double sigma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/lognormal/pdf.h" +#include "stdlib/constants/float64/eps.h" +#include +#include + +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +int main( void ) { + double sigma; + double mu; + double x; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.1, 10.0 ); + mu = random_uniform( -5.0, 5.0 ); + sigma = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 5.0 ); + y = stdlib_base_dists_lognormal_pdf( x, mu, sigma ); + printf( "x: %lf, μ: %lf, σ: %lf, f(x;μ,σ): %lf\n", x, mu, sigma, y ); + } +} +``` + +
+ + + +
+ + +