1.0.2 • Published 3 months ago

@toshiara/special-gamma v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

Gamma Function

The gamma function.

The gamma function extends the factorial function to real and complex numbers. If n is a positive integer,

\Gamma (n) = (n-1)!

Generalized to all complex numbers z, except for nonpositive integers, the gamma function can be expressed as an infinite product

\Gamma ( z ) = \frac{e^{-\gamma z}}{z} \prod^{\infty}_{n=1} \left ( 1+\frac{z}{n}\right )^{-1} e^{z/n}

This package is a rewrite of @stdlib/math-base-special-gamma in Typescript. This package supports both CommonJs and ES Modules.

Usage

// for CommonJs
const { gamma } = require('@toshiara/special-gamma');

// for ES Modules
import { gamma } from '@toshiara/special-gamma';

gamma(x)

Evaluates the gamma function.

gamma(4.0);
// returns 6.0

gamma(-1.5);
// returns 2.3632718012073544

gamma(-0.5);
// returns -3.5449077018110318

gamma(0.5);
// returns 1.7724538509055159

gamma(0.0);
// returns Infinity

gamma(-0.0);
// returns -Infinity

gamma(NaN);
// returns NaN
1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago