what is the MATLAB function to evaluate ncr value when n is real
90 ビュー (過去 30 日間)
古いコメントを表示
PJS KUMAR
2018 年 8 月 25 日
コメント済み: Walter Roberson
2018 年 8 月 25 日
what is the MATLAB function to evaluate ncr value when n is real
6 件のコメント
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
2018 年 8 月 25 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!