Course Content
Matlab Basics
Matlab Basics
Generating Combinations
Analyzing combinations comes up frequently in all sorts of analysis, and here you'll dive into generating three types of combinations in Matlab and complete the first module of our logistics data analysis (next chapter):
Unordered combinations with replacement;
Unordered combinations without replacement;
Ordered permutations.
Matlab has many safety features built in to prevent it from ever harming your computer, but you can still run code that will take forever to finish! In these cases, instead of shutting Matlab down, you can simply hit:
Ctrl
+C
;Cmd
+C
.
To stop code in progress.
Task
The number of ways of forming ordered permutations (with replacement) of elements from a larger set of elements is given by the formula: . That's choices for each element in the permutation, multiplied together times to get the total number of possibilities.
The average sentence contains between 15-20 words. Let's consider a 20-word sentence.
Assuming that the vocabulary size is , how many unique sentences can be formed?
Take 3 different vocabulary sizes: 1000 words, 10000 words, 100000 words. For each of them, calculate how many unique sentences can be formed.
Compare each of these numbers to the estimated number of atoms in the universe: .
In the formula, vocabulary size is represented by , while the number of words is .
Thanks for your feedback!