Article 5QQPP Gamma of integer plus one over integer

Gamma of integer plus one over integer

by
John
from John D. Cook on (#5QQPP)

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,

gamma_pi1.svg

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,

gamma_int_plus_frac1.svg

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

gamma_int_plus_frac2.svg

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.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments