diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logpdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logpdf/README.md index d125b82385de..f3edd8896c16 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logpdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logpdf/README.md @@ -146,6 +146,105 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/cauchy/logpdf.h" +``` + +#### stdlib_base_dists_cauchy_logpdf( x, x0, gamma ) + +Evaluates the natural logarithm of the [probability density function][pdf] (PDF) for a [Cauchy][cauchy-distribution] distribution with parameters `x0` (location parameter) and `gamma > 0` (scale parameter). + +```c +double out = stdlib_base_dists_cauchy_logpdf( 0.5, 0.0, 2.0 ); +// returns ~0.333 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **x0**: `[in] double` location parameter. +- **gamma**: `[in] double` scale parameter. + +```c +double stdlib_base_dists_cauchy_logpdf( const double x, const double x0, const double gamma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/cauchy/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 gamma; + double x0; + double x; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.0, 10.0 ); + x0 = random_uniform( -5.0, 5.0 ); + gamma = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 ); + y = stdlib_base_dists_cauchy_logpdf( x, x0, gamma ); + printf( "x: %lf, x0: %lf, γ: %lf, ln(f(x;x0,γ)): %lf\n", x, x0, gamma, y ); + } +} +``` + +
+ + + +
+ + +