Gamma of integer plus one over integer
The gamma function satisfies
(x+1) = x (x)
and so in principle you could calculate the gamma function for any positive real number if you can calculate it on the interval (0, 1). For example,
So if you're able to compute (-3) then you could compute ().
If n is a positive integer is some number between 0 and 1, is there a more direct way to express (n + ) in terms of ()?
There is when is the reciprocal of an integer. For example,
The multiple exclamation marks may look strange if you haven't seen this notation before. See the previous post for an explanation.
The general equation for integer k is
where k is a notation for k-factorial I suggested in the previous post. A more common notation would be to put !(k) to the right of the argument rather than k on the left.
Here's Python code demonstrating that the equation above holds for randomly selected n and k.
from operator import mulfrom functools import reducefrom scipy.special import gammaimport numpy as npdef multifactorial(n, k): return reduce(mul, range(n, 0, -k), 1)def f1(n, k): return gamma(n + 1/k)def f2(n, k): return multifactorial(k*n - k + 1, k)*gamma(1/k)/k**nnp.random.seed(20211014)for _ in range(1000): n = np.random.randint(1, 50) k = np.random.randint(1, 50) a, b = f1(n,k), f2(n, k) assert( abs(a/b - 1) The post Gamma of integer plus one over integer first appeared on John D. Cook.