Binomial coefficient

From Wikimization

(Difference between revisions)
Jump to: navigation, search
Line 31: Line 31:
==References==
==References==
-
336. M.J. Kronenburg, [https://arxiv.org/pdf/1105.3689.pdf "The Binomial Coefficient for Negative Arguments"], arXiv:1105.3689.
+
336. M.J. Kronenburg, [https://arxiv.org/pdf/1105.3689.pdf "The Binomial Coefficient for Negative Arguments"], arXiv:1105.3689v2

Revision as of 17:55, 16 September 2024

full definition, Matlab

binomial coefficient from M.J. Kronenburg [336]

Also see: Wolfram LaTeX: \alpha

full binomial coefficient definition including negative argument
full binomial coefficient definition including negative argument
function y = binomial(n, k)
if ~k || k == n
   y = 1;
elseif k == 1
   y = n;
elseif n < 0
   if k > 0
      y = (-1)^k*nchoosek(-n+k-1, k);
   elseif k <= n
      y = (-1)^(n-k)*nchoosek(-k-1, n-k);
   elseif n < k && k < 0
      y = 0;
   end
elseif n >= 0
   if k < 0 || k > n
      y = 0;
   else
      y = nchoosek(n,k);
   end
end
return

References

336. M.J. Kronenburg, "The Binomial Coefficient for Negative Arguments", arXiv:1105.3689v2

Personal tools