combinat::choose
-- Computes all
k-subsets of a given setcombinat::choose
(set,k)
computes all
k
-subsets of the given set set
combinat::choose
(N,k)
computes all
k
-subsets of the set setN
where setN
=
1,2,...,N.
combinat::choose(set,k)
combinat::choose(N,k)
set |
- | a set of domain type DOM_SET |
k |
- | a nonnegative integer |
N |
- | a nonnegative integer |
combinat::choose
returns an expression sequence,
consisting of the computed subsets.
Compute all the subsets of a,b,c,d,e containing 3 elements
>> combinat::choose({a,b,c,d,e},3)
{c, d, e}, {b, d, e}, {a, d, e}, {b, c, e}, {a, c, e}, {a, b, e}, {b, c, d}, {a, c, d}, {a, b, d}, {a, b, c}
Compute all the subsets of 1,2,3 containing 2 elements
>> combinat::choose(3,2)
{2, 3}, {1, 3}, {1, 2}
It's not a good idea to compute the subsets containing -1 element
>> combinat::choose({a,3},-1)
Error: Second argument must be a nonnegative integer [combinat\ ::choose]