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..64b6a72b6ecf 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][logpdf] of a [Cauchy][cauchy-distribution] distribution with location parameter `x0` and scale parameter `gamma` at a value `x` (in [nats][nats]). + +```c +double y = stdlib_base_dists_cauchy_logpdf( 2.0, 1.0, 1.0 ); +// returns ~-1.838 +``` + +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 x; + double x0; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.0, 100.0 ) - 100.0; + x0 = random_uniform( 0.0, 100.0 ) - 50.0; + gamma = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + y = stdlib_base_dists_cauchy_logpdf( x0, gamma ); + printf( "x: %lf x0: %lf, gamma: %lf, F(x0;gamma): %lf\n", x, x0, gamma, y ); + } +} +``` + +
+ + + +
+ + +