Download Random Combinations and Permutations.nlogo (48 KB)

## Random Combinations and Permutations

Random Combinations and Permutations is authored in the NetLogo modeling-and-simulation environment. The model is part of ProbLab, a curricular unit designed to enrich student understanding of the domain. The online unit package will include a suite of models, student worksheets, and a teacher guide. Below is an applet of Stochastic Cryptology. You can interact with this model by changing the slider values and then pressing Rerun to run this model under different settings. For more details, please see the model itself in the NetLogo library. Note that this model is still under development and is yet to undergo our rigorous checkout procedure.

CM ProbLab: Random Combinations and Permutations -- Combinations, permutations, and their relationships
Don't see nothin'?

Gist

Random Combinations and Permutations invites you to set up a secret combination and then see how long it takes the computer to find it. That's when SINGLE-SUCCESS is set to 'On.' Follow the instructions at the top of the model applet. If you set SINGLE-SUCCESS to 'Off,' then the program will keep track of how many times or how often it finds the combination. The histogram grows to show you how many times the combination is found out of each sample of 1,000 attempts. You can change the size of the sample, and you can change the histogram to a graph. Also, you can work with dice instead of colors. You can even change the height and width of the array to work with more or less squares.
There is a multiple-choice widget called ANALYSIS-TYPE This controls whether or not we care for the order of the colors or the dice in the combination you created. For instance, if you create a dice combination "1, 2, 3," then if ANALYSIS-TYPE is set to "Combinations," only "1, 2, 3" will be accepted as a 'find.' But if ANALYSIS-TYPE is set to "Permutation," then "3, 1, 2" will be accepted as a find. So will "1, 3, 2" (what else)? In any case, the program keeps track of how many times it finds the combination in the correct and in the incorrect order. So what does that multiple-choice button do? It governs whether or not you'll see these results being plotted. If you set the choice button to "Both," then both types of event will be recorded.

Questions to Ponder

• This is where it gets really interesting. One could expect that there will be more finds when order does not matter than when it matters. But is that always true? Are there cases where there will be just as many finds under both conditions?

• When there are more finds of "Permutations," how many more are there? Is there some method here? What does it depend on?

• Using the default settings of three boxes, set the ANALYSIS-TYPE choice button to "Both" and create a combination that is anything but all green or all blue. Now press Search Combi and watch the histograms grow. The black histogram is to the left of the red one. It also grows narrower and taller than the red one. What can you make of all this? Does the black histogram cover more area than the red histogram?

• Is there a relation between the number of boxes in the combination and the number of times the model finds your combination?

[Last updated April 7, 2005]