diff --git a/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/pdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/pdf/README.md index 26232640a149..df35ce06d99c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/pdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/truncated-normal/pdf/README.md @@ -145,6 +145,111 @@ for ( i = 0; i < 25; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/truncated-normal/pdf.h" +``` + +#### stdlib_base_dists_truncated_normal_pdf( x, a, b , mu , sigma ) + +Evaluates the r distribution function (pdf) for an truncated-normal distribution. + +```c +double out = stdlib_base_dists_truncated_normal_pdf( 0.9, 0.0, 1.0, 0.0, 1.0 ); +// returns ~0.7795 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **a**: `[in] double` lower limit. +- **b**: `[in] double` upper limit. +- **mu**: `[in] double` location parameter. +- **sigma**: `[in] double` scale parameter. + + +```c +double stdlib_base_dists_truncated-normal_pdf( const double x, const double a, const double b , const double mu , const double sigma ); +``` +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/truncated-normal/pdf.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 ) { + double x; + double a; + double b; + double mu; + double sigma; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( -10.0, 10.0 ); + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + mu = random_uniform( a, b ); + sigma = random_uniform( 0.1, 5.0 ); + y = stdlib_base_dists_truncated_normal_pdf( x, a, b, mu, sigma ); + printf( "x: %lf, a: %lf, b: %lf, mu: %lf, sigma: %lf, f(x;a,b,mu,sigma): %lf\n", x, a, b, mu, sigma, y ); + } +} +``` + +
+ + + +
+ + +