MATLAB: What is the MATLAB function to evaluate ncr value when n is real

ncr value

what is the MATLAB function to evaluate ncr value when n is real

Best Answer

If n and r are both non-negative integers, and n >= r, use:
nCr = nchoosek(n,r)
If n and/or r can be negative, you can use the more general form:
nCr = gamma(n+1)/(gamma(r+1)*gamma((n-r)+1))
If either n or r is an integer <= -1, then the nCr is not defined.