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

This function can return N choose K (K <= N) as well as a BC matrix up to N choose N.
188 Downloads
Aktualisiert 30. Dez 2011

Lizenz anzeigen

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.

Zitieren als

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. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2011a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Discrete Math finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
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