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

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

6 件のコメント

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2018 年 8 月 25 日
What is ncr?
Walter Roberson
Walter Roberson 2018 年 8 月 25 日
Number of combinations??
You can easily transform the traditional factorial definition of combinations to use the GAMMA function, but as soon as you go for negative values you have a problem that GAMMA of negative values is infinite.
PJS KUMAR
PJS KUMAR 2018 年 8 月 25 日
formula to find number of different combinations of n distinct objects taken r at a time
Walter Roberson
Walter Roberson 2018 年 8 月 25 日
What result are you expecting for nCr(-3,pi) ?
PJS KUMAR
PJS KUMAR 2018 年 8 月 25 日
expecting result for instances like nCr(0.5,2) , nCr(-3,2)
Walter Roberson
Walter Roberson 2018 年 8 月 25 日
What numeric values do you expect for the cases nCr(0.5,2) and nCr(-3,2) ? Number of combinations is only defined for positive integers.

サインインしてコメントする。

 採用された回答

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2018 年 8 月 25 日

2 投票

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.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by