diff --git a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/README.md index dff609d5733b..d40d8b51e159 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/README.md @@ -147,6 +147,112 @@ for ( i = 0; i < 10; i++ ) { + + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/discrete-uniform/logcdf.h" +``` + +#### stdlib_base_dists_discrete_uniform_logcdf( x, a, b ) + +Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support). + +```c +double out = stdlib_base_dists_discrete_uniform_logcdf( 9.0, 0, 10 ); +// returns ~-0.095 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **a**: `[in] int32_t` minimum support. +- **b**: `[in] int32_t` maximum support. + +```c +double stdlib_base_dists_discrete_uniform_logcdf( const double x, const int32_t a, const int32_t b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/discrete-uniform/logcdf.h" +#include "stdlib/math/base/special/round.h" +#include +#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 ) { + int32_t a; + int32_t b; + double x; + double y; + int i; + + for ( i = 0; i < 10; i++ ) { + x = random_uniform( -10.0, 10.0 ); + a = stdlib_base_round( random_uniform( 0.0, 10.0 ) ); + b = stdlib_base_round( random_uniform( 0.0, 10.0 ) ) + a; + y = stdlib_base_dists_discrete_uniform_logcdf( x, a, b ); + printf( "x:%lf, a: %d, b: %d, ln(F(X;a,b)): %lf\n", x, a, b, y ); + } +} +``` + +
+ + + +
+ + + + + +
+ +
+ + +