Find and return Binomial Coefficients (BCs) in a matrix up to N.

版本 1.2.0.0 (2.6 KB) 作者: Bruce Raine
This function can return N choose K (K <= N) as well as a BC matrix up to N choose N.
188.0 次下载
更新时间 2011/12/30

查看许可证

The function BINOMIND(N,K,SPEED) does not use loops (apart from a redundant check) or division nor indeed factorials to generate the Binomial Coefficients (BCs). It simply constructs the lower-triangular Pascal matrix and does a simple lookup to get the desired BC.

BINOMIND is much faster than NCHOOSEK at creating matrices of BCs if you set SPEED to TRUE and also has a basic integrity check to compare it with nchoosek. It can return 3 lots of data: comb,binTable, errorRate but you can just use it to find combinations by default.

引用格式

Bruce Raine (2024). Find and return Binomial Coefficients (BCs) in a matrix up to N. (https://www.mathworks.com/matlabcentral/fileexchange/34375-find-and-return-binomial-coefficients-bcs-in-a-matrix-up-to-n), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Discrete Math 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.2.0.0

Fixed one bug in the 'if nargin' statement on line 43 and improved 'if k > n' error message on line 49.

1.1.0.0

I added more input parameter checking, an extra input parameter, SPEED as well as a warning message for COMB values above a predefined tolerance limit. I also improved the documentation of the function.

1.0.0.0