diff --git a/lib/node_modules/@stdlib/math/base/special/gammaincinv/README.md b/lib/node_modules/@stdlib/math/base/special/gammaincinv/README.md index 7426de70ddd1..64c2dc236129 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaincinv/README.md +++ b/lib/node_modules/@stdlib/math/base/special/gammaincinv/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. @@ -70,7 +70,7 @@ Again, for given `p` and `a` the function returns the `x` which satisfies `p = Q var gammaincinv = require( '@stdlib/math/base/special/gammaincinv' ); ``` -#### gammaincinv( p, s\[, upper ] ) +#### gammaincinv( p, a\[, upper ] ) Inverts the regularized incomplete gamma function. Contrary to the more commonly used definition, in this implementation the first argument is the probability `p` and the second argument is the scale factor `a`. By default, the function inverts the _lower_ regularized incomplete gamma function, `P(x,a)`. To invert the _upper_ function instead, i.e. `Q(x,a)`, set the `upper` argument to `true`. @@ -136,6 +136,92 @@ logEachMap( 'p: %0.4f, \t a: %0.4f, \t P^(-1)(p, a): %0.4f', p, a, gammaincinv ) + +
+ +## C API + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/gammaincinv.h" +``` + +#### stdlib_base_gammaincinv( p, a, upper ) + +Inverts the regularized incomplete gamma function. + +```c +double y = stdlib_base_gammaincinv( 0.5, 2.0, false ); +// returns ~1.678 + +y = stdlib_base_gammaincinv( 0.1, 10.0, false ); +// returns ~6.221 + +y = stdlib_base_gammaincinv( 0.75, 3.0, true ); +// returns ~1.727 +``` + +The function accepts the following arguments: + +- `p`: `[in] double` input probability. +- `a`: `[in] double` scale parameter. +- `upper`: `[in] bool` boolean indicating if the function should invert the upper tail of the incomplete gamma function. + +```c +double stdlib_base_gammaincinv( const double p, const double a, const bool upper ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/gammaincinv.h" +#include +#include + +int main( void ) { + double p; + double a; + double y; + int i; + + for ( i = 0; i < 100; i++ ) { + p = (double)rand() / (double)RAND_MAX; + a = ( ( (double)rand() / (double)RAND_MAX ) * 20.0 ); + y = stdlib_base_gammaincinv( p, a, false ); + printf( "p: %lf, a: %lf, y: %lf\n", p, a, y ); + } +} +``` + +
+ + + +
+ + +