# Restrict Binomial/Factorial to non-analytically continued versions

I like to use the (common) representations of the binomials for integer arguments, such that eg Binomial[1/2,1] evaluates to 0 rand not to 1/2. Is there a simple generic way to do this?

This is relevant since there are quite some standard expressions and equations which are based on that, e.g. definition of Fibonacci Polynomials, ...

• In version 11.3., Binomial[1/2, 1] does evaluate to 1/2. If your version does not support this, you might define binomial[n_, m_] := Gamma[n + 1]/(Gamma[m + 1] Gamma[n - m + 1]). Commented Apr 12, 2018 at 11:42
• @HenrikSchumacher: I also get 1/2 but I need a simple way to get to 0. Commented Apr 12, 2018 at 11:44
• Ah, now I got it (hopefully...) Commented Apr 12, 2018 at 11:46

Try this:

ClearAll[binomial]
binomial[
n_?(StatisticsLibraryRealIntegerQ[#] && Positive[#] &),
m_?(StatisticsLibraryRealIntegerQ[#] && Positive[#] &)
] := Binomial[Round[n], Round[m]];
binomial[n_, m_] := 0;


Older, less robust version

ClearAll[binomial]
binomial[
n_Integer?Positive,
m_Integer?Positive
] := Binomial[n,m];
binomial[n_, m_] := 0;

• Perfect! Thanks a lot!! Commented Apr 12, 2018 at 11:49
• See also last edit. The old version did not behave as desired for negative arguments and for integers in disguise (such as binomial[2.,1] also returned 0). Just tell me if you happen to observe bugs. Commented Apr 12, 2018 at 11:57
• Well, actually what I was looking for was anyway the version for natural numbers, and it was easy to understand. Thus, would it be possible that you still give the old answer as an alternative? Commented Apr 12, 2018 at 12:00