Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /data/1/b/1b32a628-bdcf-4151-86ff-5d5550106b39/nonconditional.com/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 380
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /data/1/b/1b32a628-bdcf-4151-86ff-5d5550106b39/nonconditional.com/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 380
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /data/1/b/1b32a628-bdcf-4151-86ff-5d5550106b39/nonconditional.com/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 380
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /data/1/b/1b32a628-bdcf-4151-86ff-5d5550106b39/nonconditional.com/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 380
So if you want to calculate n choose k, or n over k or all k different combinations of n unique items or binomial coefficients in Matlab or in math language
\[\frac{n!}{(n-k)! k!}\]
you can write
nchoosek(n,k) |
But lets say you want to generate a list of these possible combinations? Well then you just write n as a vector
n = [1, 2, 3, 4] = [1:4] |
so this would generate using $$k = 2$$
nchoosek(1:4,2)[1 2; 1 3; 1 4; 2 3; 2 4; 3 4] |
or why not do
nchoosek([1,4,10,17],2) = [1 4; 1 10; 1 17; 4 10; 4 17; 10 17] |
Awesome discovery at 8.00 pm!