Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Predefined Structures in the combstruct Package
Calling Sequence
combstruct[function](struct(args), size=n)
Parameters
struct
-
one of a predefined list of available structures
args
argument list that corresponds to the structure struct
n
(optional) non-negative integer specifying the size of the object or the string 'allsizes'
Description
Some special combinatorial classes are predefined in the combstruct package. They are Combination or Subset, Permutation, Partition, and Composition.
Combination or Subset:
Combinations (or subsets) of elements
The argument is a set, list, or non-negative integer. In the case of a non-negative integer n, it is treated as the set . The default size is .
Use the string 'allsizes' when the object is selected from all possible sizes. If the size is not specified, each structure has default behavior.
Permutation:
Permutations of elements
The argument is a set, list, or non-negative integer. In the case of a non-negative integer n, it is treated as the list . The default size is the number of elements in the set/list.
Partition:
Partitions of positive integers into sums of positive integers without regards to order.
The argument is a positive integer. The default size is 'allsizes'.
Composition:
Composition of a positive integer n into a positive integer k parts of size at least 1, where the order of summands is meaningful.
The argument is a positive integer. The default size is .
Combination and Subset are different names for the same structure.
You can define your own structure that is understood by the functions in the combstruct package. To create the structure Foo, create the procedures `combstruct/count/Foo`, `combstruct/draw/Foo`, `combstruct/allstructs/Foo`, and `combstruct/iterstructs/Foo`.
Each of these functions must take size as their first argument, a non-negative integer, the string or the string , with the arguments that your structure needs. Thus, invokes `combstruct/draw/Foo`(n, x, y, z).
Examples
Count all possible subsets of .
Draw a combination of that has 4 elements.
Count the permutations of , using all three elements.
Create an iterator over all the permutations of that consist of only two elements.
Draw any partition of 9.
List all the compositions of 3 in 2 parts.
See Also
combstruct, combstruct[allstructs], combstruct[count], combstruct[draw], combstruct[iterstructs]
Download Help Document