Beta Function / natural logarithm of the Beta function
Evaluates the beta function and the natural logarithm of the beta function.
The Beta function, also called the Euler integral, is defined as
\mathrm{Beta}(x,y) = \int_0^1t^{x-1}(1-t)^{y-1}\,\mathrm{d}t
It is related to the Gamma function via the following equation
\mathrm{Beta}(x, y) = \dfrac{\Gamma(x)\,\Gamma(y)}{\Gamma(x + y)}
and
\ln \mathrm{Beta}(x,y)= \ln \Gamma(x) + \ln \Gamma(y) - \ln \Gamma(x+y)
This package supports both CommonJs and ES Modules.
Installation
$ npm install @toshiara/special-beta
Usage
// for CommonJs
const { beta, betaln } = require('@toshiara/special-beta');
// for ES Modules
import { beta, betaln } from '@toshiara/special-beta';
beta(x, y)
Evaluates the beta function.
beta(1.2, 2.4);
// returns 0.3068371659652535
beta(0.1, 0.3);
// returns 12.8305985363213
betaln(x, y)
Evaluates the beta function.
betaln(1, 2);
// returns -0.6931471805599453
betaln(1.2, 2.4);
// returns -1.181438076130887