diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/pdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/cauchy/pdf/README.md index 6496cdbc5696..c9ae1efa989a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/pdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/pdf/README.md @@ -139,6 +139,105 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/cauchy/pdf.h" +``` + +#### stdlib_base_dists_cauchy_pdf( x, x0, gamma ) + +Evaluates 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_pdf( 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_pdf( const double x, const double x0, const double gamma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/cauchy/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 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( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + y = stdlib_base_dists_cauchy_pdf( x, x0, gamma ); + printf( "x: %lf, k: %lf, γ: %lf, f(x;x0,γ): %lf\n", x, x0, gamma, y ); + } +} +``` + +
+ + + +
+ + +