diff --git a/lib/node_modules/@stdlib/stats/base/dists/exponential/pdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/exponential/pdf/README.md index be2685c9940e..cd56be3a1f4c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/exponential/pdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/exponential/pdf/README.md @@ -127,6 +127,110 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/exponential/pdf.h" +``` + +#### stdlib_base_dists_exponential_pdf( x, lambda ) + +Evaluates the [probability density function][pdf] (PDF) for an [exponential][exponential-distribution] distribution with rate parameter `lambda`. + +```c +double out = stdlib_base_dists_exponential_pdf( 2.0, 0.7 ); +// returns ~0.173 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **lambda**: `[in] double` rate parameter. + +```c +double stdlib_base_dists_exponential_pdf( const double x, const double lambda ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/exponential/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 lambda; + double x; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.0, 100.0 ); + lambda = random_uniform( 0.0, 100.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + y = stdlib_base_dists_exponential_pdf( x, lambda ); + printf( "x: %lf, λ: %lf, f(x;λ): %lf\n", x, lambda, y ); + } +} +``` + +
+ + + +
+ + + + + +
+ +
+ + +