diff --git a/lib/node_modules/@stdlib/stats/base/dists/exponential/logpdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/exponential/logpdf/README.md index 0c1bd0d6a8ab..b64fcb6df9a5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/exponential/logpdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/exponential/logpdf/README.md @@ -137,6 +137,102 @@ for ( i = 0; i < 10; i++ ) { + + +
+ + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/exponential/logpdf.h" +``` + +#### stdlib_base_dists_exponential_logpdf( x, lambda ) + +Evaluates the natural logarithm of the [probability density function][pdf] (PDF) for an [exponential][exponential-distribution] distribution with rate parameter `lambda`. + +```c +double out = stdlib_base_dists_exponential_logpdf( 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_logpdf( const double x, const double lambda ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/exponential/logpdf.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( STDLIB_CONSTANT_FLOAT64_EPS, 100.0 ); + y = stdlib_base_dists_exponential_logpdf( x, lambda ); + printf( "x: %lf, λ: %lf, ln(f(x;λ)): %lf\n", x, lambda, y ); + } +} +``` + +
+ + +