Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Generating Combinations | Learning Through Applications
Matlab Basics
course content

Course Content

Matlab Basics

Matlab Basics

1. Basic Syntax and Coding with a Text Editor
2. Coding Foundations
3. Learning Through Applications
4. Visualizations
5. Recursion and Matrix Multiplication

book
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.

Note
Note

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 mm elements from a larger set of nn elements is given by the formula: nmn^m. That's nn choices for each element in the permutation, multiplied together mm times to get the total number of possibilities.

The average sentence contains between 15-20 words. Let's consider a 20-word sentence.

1. Derive the Permutations Formula
expand arrow

Assuming that the vocabulary size is nn, how many unique sentences can be formed?

2. Calculate the Number of Permutations
expand arrow

Take 3 different vocabulary sizes: 1000 words, 10000 words, 100000 words. For each of them, calculate how many unique sentences can be formed.

3. Compare to the Number of Atoms
expand arrow

Compare each of these numbers to the estimated number of atoms in the universe: 108010^{80}.

In the formula, vocabulary size is represented by nn, while the number of words is mm.

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

course content

Course Content

Matlab Basics

Matlab Basics

1. Basic Syntax and Coding with a Text Editor
2. Coding Foundations
3. Learning Through Applications
4. Visualizations
5. Recursion and Matrix Multiplication

book
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.

Note
Note

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 mm elements from a larger set of nn elements is given by the formula: nmn^m. That's nn choices for each element in the permutation, multiplied together mm times to get the total number of possibilities.

The average sentence contains between 15-20 words. Let's consider a 20-word sentence.

1. Derive the Permutations Formula
expand arrow

Assuming that the vocabulary size is nn, how many unique sentences can be formed?

2. Calculate the Number of Permutations
expand arrow

Take 3 different vocabulary sizes: 1000 words, 10000 words, 100000 words. For each of them, calculate how many unique sentences can be formed.

3. Compare to the Number of Atoms
expand arrow

Compare each of these numbers to the estimated number of atoms in the universe: 108010^{80}.

In the formula, vocabulary size is represented by nn, while the number of words is mm.

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
some-alt