diff --git a/lib/node_modules/@stdlib/math/base/special/polygamma/README.md b/lib/node_modules/@stdlib/math/base/special/polygamma/README.md index 8163af4edca0..e23d3b320e2e 100644 --- a/lib/node_modules/@stdlib/math/base/special/polygamma/README.md +++ b/lib/node_modules/@stdlib/math/base/special/polygamma/README.md @@ -123,6 +123,106 @@ logEachMap( 'ψ^(%d)(x = %0.4f): %0.4f', n, x, polygamma ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/polygamma.h" +``` + +#### stdlib_base_polygamma( n, x ) + +Evaluates the [polygamma function][polygamma-function] of order `n`; i.e., the `(n+1)`th derivative of the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma]. + +```c +double out = stdlib_base_polygamma( 3, 1.2 ); +// returns ~3.245 + +out = stdlib_base_polygamma( 5, 1.2 ); +// returns ~41.39 +``` + +The function accepts the following arguments: + +- **n**: `[in] int32_t` order of derivative (nonnegative integer). +- **x**: `[in] double` input value. + +```c +double stdlib_base_polygamma( const int32_t n, const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/polygamma.h" +#include "stdlib/math/base/special/floor.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 n; + double x; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + n = (int32_t)stdlib_base_floor( random_uniform( 0.0, 51.0 ) ); + x = random_uniform( -50.0, 50.0 ); + y = stdlib_base_polygamma( n, x ); + printf( "polygamma(%d, %lf) = %lf\n", n, x, y ); + } +} +``` + +
+ + + +
+ + +