diff --git a/lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/README.md index 435b8c72954f..667ae2208395 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2026 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -164,6 +164,114 @@ logEachMap( 'x: %0.4f, k: %d, λ: %0.4f, F(x;k,λ): %0.4f', x, k, lambda, cdf ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/erlang/cdf.h" +``` + +#### stdlib_base_dists_erlang_cdf( x, k, lambda ) + +Evaluates the [moment-generating function][cdf] (CDF) for an [Erlang][erlang-distribution] distribution with parameters `k` (shape parameter) and `lambda` (rate parameter). + +```c +double y = stdlib_base_dists_erlang_cdf( 2.0, 1, 1.0 ); +// returns ~0.865 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **k**: `[in] double` shape parameter. +- **lambda**: `[in] double` rate parameter. + +```c +double stdlib_base_dists_erlang_cdf( const double t, const double k, const double lambda ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/erlang/cdf.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 ) { + double x; + int32_t k; + double lamda; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.0, 10.0 ); + k = stdlib_base_round( random_uniform( 0.0, 10.0 ) ); + lamda = random_uniform( 0.0, 5.0 ); + y = stdlib_base_dists_erlang_cdf( x, k, lamda ); + printf( "x: %lf, k: %d, lambda: %lf, F(x;k,lambda): %lf\n", x, k, lamda, y ); + } +} +``` + +
+ + + +
+ + + + + +
+ +
+ + +