I have a product of the following form:

$$ P = (N-\alpha)(N-2\alpha)\cdots(N-k\alpha) $$

where $k$ is an integer between $1$ and $N-1$, and $\alpha$ is a real number in $(0,1]$.

Clearly, for $\alpha=1$,

$$ P = \frac{(N-1)!}{(N-k-1)!} $$

Now, in general I can write:

$$ P = \alpha^k \left(\frac{N}{\alpha}-1\right) \left(\frac{N}{\alpha}-2\right) \cdots \left(\frac{N}{\alpha}-k\right) $$

This looks like a factorial, but $\frac{N}{\alpha}$ is not an integer in general. I tried rounding it up and using the factorial function anyway. This gave results in the right ballpark (at least for the values I tried), but they were still off by quite a bit, which I assume is because the rounding error is being multiplied.

I am not very familiar with the Gamma function, but looking at its definition and relation to the factorial function, I took a guess and wrote:

$$ P = \alpha^k \frac{\Gamma\left(\frac{N}{\alpha}\right)}{\Gamma\left(\frac{N}{\alpha}-k\right)} $$

This gave exactly the same results as the factorial function with rounding.

Is this a proper way of using the Gamma function?

Is there a more accurate way to write $P$ using it or anything else?


You can write $P$ with the Gamma function, but more simply using falling powers. There are several notations, but using the one from the linked wiki article, $(n)_k=n(n-1)(n-2)\cdots (n-k+1)$. Hence, $$P=\alpha^k \left(\frac{N}{\alpha}-1\right)_k$$

| cite | improve this answer | |
  • $\begingroup$ Perfect, thank you. Out of curiosity, do you think it's possible to prove that in this case the error with rounding in factorial function is equal to the error with the gamma function? $\endgroup$ – MGA Dec 10 '15 at 3:34
  • $\begingroup$ There is no rounding, all of these are exact. The benefit of this notation is that it is the simplest one that meets your needs. $\endgroup$ – vadim123 Dec 10 '15 at 3:48
  • $\begingroup$ You're right, the Gamma one is exact - it was only that my software was making numerical inaccuracies for large values of $N$ and $k$. Using the factorial and rounding $N/\alpha\approx \left[N/\alpha\right]$, though, is of course not exact. $\endgroup$ – MGA Dec 10 '15 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.