MLC Lab Visit - More Combinatorics
Mth 355 Fall 2001 Assignment 5 (at end). Due Oct 31.
Mth 355 (a.k.a. Mth 399) Oct 23 2001 Maple 6
Bent E. Petersen
Filename: 355f2001-assign-05-combinat.mws
Maple has quite a bit of combinatorial support available in the combstruct and combinat packages. This
Worksheet is a summary of some of the combinatorial computations you can do with Maple. At the end
of the worksheet are a few problems which constitute Assignment 5.
>
restart;
>
with(combstruct);
[
]
,,
,
,
,
,
,
,
allstructs count draw finished gfeqns gfseries gfsolve iterstructs nextstruct
>
with(combinat);
Warning, the protected name Chi has been redefined and unprotected
Chi
bell
binomial
cartprod character choose composition conjpart decodepart encodepart
,
,
,
,
,
,
,
,
[
fibonacci firstpart graycode inttovec lastpart multinomial nextpart numbcomb numbcomp
,
,
,
,
,
,
,,,
numbpart numbperm partition permute powerset prevpart randcomb randpart randperm
,
,
,
,
,
,
,
stirling1 stirling2 subsets vectoint
,]
Permutations
The
allstructs()
function produces a list of all permutations of the specified objects. The function
iterstructs()
allows one to iterate over the list of objects which would be returned by
allstructs(),
without first returning the list.
Here are the 2-permutations of
[a,b,c,d]
>
allstructs(Permutation([a,b,c,d]),size=2);
[
]
,,,,,,,,,,,
[]
,
ab
,
ac
,
ad
,
ba
,
bc
,
bd
,
ca
,
cb
,
cd
,
da
,
db
,
dc
If the argument provided is an integer
n,
rather than a list, it is treated as the list
[1,.
..,n].
Thus
>
allstructs(Permutation(4),size=2);
[
]
,
12 [
]
,
13 [
]
,
14 [
]
,
21 [
]
,
23 [
]
,
24 [
]
,
31 [
]
,
32 [
]
,
34 [
]
,
41 [
]
,
42 [
]
,
43
To use an iterator instead is simple
>
iter1:=iterstructs(Permutation([a,b,c,d]),size=2):