time-to-botec/js/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

3.0 KiB

Gamma Lanczos Sum

Calculate the Lanczos sum for the approximation of the gamma function.

The Lanczos approximation for the gamma function can be written in partial fraction form as follows:

Lanczos approximation for gamma function.

where g is an arbitrary constant and L_g(n) is the Lanczos sum.

Usage

var gammaLanczosSum = require( '@stdlib/math/base/special/gamma-lanczos-sum' );

gammaLanczosSum( x )

Calculates the Lanczos sum for the approximation of the gamma function.

var v = gammaLanczosSum( 4.0 );
// returns ~950.366

v = gammaLanczosSum( -1.5 );
// returns ~1373366.245

v = gammaLanczosSum( -0.5 );
// returns ~-699841.735

v = gammaLanczosSum( 0.5 );
// returns ~96074.186

v = gammaLanczosSum( 0.0 );
// returns Infinity

v = gammaLanczosSum( NaN );
// returns NaN

Examples

var linspace = require( '@stdlib/array/linspace' );
var gammaLanczosSum = require( '@stdlib/math/base/special/gamma-lanczos-sum' );

var x = linspace( -10.0, 10.0, 100 );
var v;
var i;

for ( i = 0; i < x.length; i++ ) {
    v = gammaLanczosSum( x[ i ] );
    console.log( 'x: %d, f(x): %d', x[ i ], v );
}