This is a fairly simple question involving mathematical notation which is outside of my expertise. I'm looking for the correct representation of a matrix M which shows all combinations of three variables, i, j & k. This is coded up in MATLAB as something like:
M = [];
for i = 0:5:20
for j = 0:2:10
for k = 0:3:12
M(end+1,:) = [i,j,k];
end
end
end
This produces a 150x3 matrix for M, here is what the first 20 lines of M look like:
0 0 0
0 0 3
0 0 6
0 0 9
0 0 12
0 2 0
0 2 3
0 2 6
0 2 9
0 2 12
0 4 0
0 4 3
0 4 6
0 4 9
0 4 12
0 6 0
0 6 3
0 6 6
0 6 9
0 6 12
So how to represent M mathematically? The first thing that comes to mind is something like this:
\begin{equation} \sum\limits_{i=0}^4 \sum\limits_{j=0}^5 \sum\limits_{j=0}^4 5i . 2j . 3k \end{equation}
But obviously this represents the sum of the elements in M, not the matrix M itself. I'm thinking the correct representation will involve the "$\forall$" operator somehow, eg. $\forall$ ..... $\forall$ ..... $\forall$ .....
Let your variable $i$ belong to some set $\mathbb{I}$, $j$ to $\mathbb{J}$, and $k$ to $\mathbb{K}$. Then the set of all combinations can be represented by $\mathbb{I} \times \mathbb{J} \times \mathbb{K}$.
By the way, here's a two-line solution to your MATLAB code that avoids looping. (Never loop in MATLAB if you can avoid it).