JSPM

@toshiara/special-gamma

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q41907F
  • License Apache-2.0

gamma function library (commonjs/esm)

Package Exports

  • @toshiara/special-gamma

Readme

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