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 téléchargements
Mise à jour 30 déc. 2011

Afficher la licence

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.

Citation pour cette source

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. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2011a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Discrete Math dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
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