Gamma and Related Functions #78065
Labels
feature
A request for a proper, new feature.
module: special
Functions with no exact solutions, analogous to those in scipy.special
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Gamma and Related Functions
A brief proposal for providing a complete suite of gamma and related functions as PyTorch operators. Enjoy!
One of a five-part series of special functions issues:
Operators
barnes_g
beta
binomial_coefficient
double_factorial
factorial
falling_factorial
gamma
log_barnes_g
log_beta
log_binomial
log_double_factorial
log_factorial
log_falling_factorial
log_gamma
log_gamma_sign
log_quadruple_factorial
log_rising_factorial
log_triple_factorial
lower_incomplete_gamma
polygamma
quadruple_factorial
reciprocal_gamma
rising_factorial
triple_factotial
upper_incomplete_gamma
Documentation
Beta function
Beta function:
A key property of the beta function is its close relationship to the gamma function:
The closeness of the relationship between the gamma and beta functions is frequently applied in calculus and statistics (e.g., beta and related probability distributions).
The beta function is also closely related to binomial coefficients. When$a$ or $b$ is a positive integer:
Binomial coefficient
Binomial coefficient:
Digamma function
The logarithmic derivative of the gamma function (i.e., the first of the polygamma functions):
The digamma function is related to the harmonic numbers by:
where$H_{0} = 0$ and gamma is the Euler–Mascheroni constant.
double_factorial(input, *, out=None) → Tensor
Double factorial function:
factorial(input, *, out=None) → Tensor
Factorial function:
The product of all positive integers less than or equal to$n$ .
Many notable functions and number sequences are related to the factorials, e.g., binomial coefficients; double, triple, and quadruple factorials; and falling factorials and rising factorials.
falling_factorial(input, *, out=None) → Tensor
Falling factorial function:
The falling factorial is extended to real values of n using the gamma function provided x and x + n are real numbers that are not negative integers.
gamma(input, *, out=None) → Tensor
Gamma function:
The standard extension of the factorial function to all complex numbers except non-positive integers.
log_beta(input, other, *, out=None) → Tensor
Natural logarithm of the Euler beta function:
log_double_factorial(input, *, out=None) → Tensor
Natural logarithm of the double factorial function:
log_factorial(input, *, out=None) → Tensor
log_falling_factorial(input, *, out=None) → Tensor
log_gamma(input, *, out=None) → Tensor
Natural logarithm of the gamma function:
log_quadruple_factorial(input, *, out=None) → Tensor
Natural logarithm of the quadruple factorial function:
log_rising_factorial(input, *, out=None) → Tensor
log_triple_factorial(input, *, out=None) → Tensor
Natural logarithm of the triple factorial function:
lower_incomplete_gamma(input, a, *, out=None) → Tensor
Lower incomplete gamma function:
Incomplete gamma functions are special functions that arise as solutions to certain integrals. They are defined similarly to the gamma function but with incomplete integral limits. Unlike the gamma function, defined as an integral from zero to infinity, the lower incomplete gamma function is defined as an integral from$0$ to $a$ .
upper_incomplete_gamma(input, a, *, out=None) → Tensor
Upper incomplete gamma function:
Incomplete gamma functions are special functions that arise as solutions to certain integrals. They are defined similarly to the gamma function but with incomplete integral limits. Unlike the gamma function, defined as an integral from zero to infinity, the upper incomplete gamma function is defined as an integral from$a$ to infinity.
polygamma(input, n, *, out=None) → Tensor
Polygamma function:
regularized_gamma(input, *, out=None) → Tensor
Regularized incomplete gamma function$Q(a, z)$ .
inverse_regularized_gamma(input, *, out=None) → Tensor
Inverse of the regularized incomplete gamma function.
incomplete_beta(input, other, z, *, out=None) → Tensor
Incomplete Euler beta function$\text{B}_{z}(\text{input}, \text{other})$ .
regularized_beta(input, *, out=None) → Tensor
Regularized incomplete beta function$I_{z}(a, b)$ .
inverse_regularized_beta(input, *, out=None) → Tensor
Inverse of the regularized incomplete beta function.
triple_factorial(input, *, out=None) → Tensor
Triple factorial,$\text{input}!!!$ .
quadruple_factorial(input, *, out=None) → Tensor
Quadruple factorial,$\text{input}!!!!$ .
log_falling_factorial(input, *, out=None) → Tensor
rising_factorial(input, *, out=None) → Tensor
The rising factorial is extended to real values of n using the gamma function provided x and x + n are real numbers that are not negative integers:
log_rising_factorial(input, *, out=None) → Tensor
barnes_g(input, *, out=None) → Tensor
Barnes G-function$G(z)$ .
ln_barnes_g(input, *, out=None) → Tensor
Natural logarithm of the Barnes G-function$\ln G(z)$ .
Notes
incomplete_gamma
is implemented asgammainc
andgammaincc
. I recommend renaminggammainc
toincomplete_gamma
for clarity and consistency. I also recommend removinggammaincc
in favor ofregularized_gamma
.cc @mruberry @kshitij12345
The text was updated successfully, but these errors were encountered: