@stdlib/math-base-special-trigammaf
v0.1.1
Published
Trigamma function for a single-precision floating-point number.
Readme
Trigamma
Trigamma function for a single-precision floating-point number.
The trigamma function ψ^(1) is the derivative of the digamma function.
Installation
npm install @stdlib/math-base-special-trigammafUsage
var trigammaf = require( '@stdlib/math-base-special-trigammaf' );trigammaf( x )
Evaluates the trigamma function for a single-precision floating-point number.
var v = trigammaf( -2.5 );
// returns ~9.539
v = trigammaf( 1.0 );
// returns ~1.645
v = trigammaf( 10.0 );
// returns ~0.105If x is 0 or a negative integer, the function returns NaN.
var v = trigammaf( 0.0 );
// returns NaN
v = trigammaf( -1.0 );
// returns NaN
v = trigammaf( -2.0 );
// returns NaNIf provided NaN, the function returns NaN.
var v = trigammaf( NaN );
// returns NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var trigammaf = require( '@stdlib/math-base-special-trigammaf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, -50.0, 50.0, opts );
logEachMap( 'x: %0.4f, ψ^(1)(x): %0.4f', x, trigammaf );C APIs
Usage
#include "stdlib/math/base/special/trigammaf.h"stdlib_base_trigammaf( x )
Evaluates the trigamma function for a single-precision floating-point number.
float out = stdlib_base_trigammaf( -2.5f );
// returns ~9.539f
out = stdlib_base_trigammaf( 1.0f );
// returns ~1.645fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_trigammaf( const float x );Examples
#include "stdlib/math/base/special/trigammaf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 4.0f, -1.5f, -0.5f, 0.5f };
float y;
int i;
for ( i = 0; i < 4; i++ ) {
y = stdlib_base_trigammaf( x[ i ] );
printf( "x: %f, ψ^(1)(x): %f\n", x[ i ], y );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
Copyright
Copyright © 2016-2026. The Stdlib Authors.
