1

Problem: What mathematical notation for iterating over the same enumerated set $\{\dots\}$ twice is most consistent with existing conventions?

Context: The specific use is for pseudocode that describes the iteration using indices $i$ and $j$ over a square $n \times n$ matrix, so $\{\dots\}$ becomes $\{1, \dots, n\}$. The use of indices is needed for reference in the subsequent lines of the pseudocode.

The following notation uses ordered pairs and applies the Cartesian product operator on the set enumeration as inspired by the answer on this question:

$\forall (i,j) \in \{\dots\}^2$

And what about this notation:

$\forall i,j \in \{\dots\}$

What is 'better'? Would the latter be confusing because the reader may think that only $j$ iterates over the set?

  • I would say the second is better, because it's easier on the reader. I don't really think it can be misinterpreted. The first is more precise, but it will cost the reader a moment or two to interpret: "Hold on $-$ do $i$ and $j$ go up to $n$, or up to $n^2$?" – TonyK Oct 10 '16 at 17:51

1 Answers1

1

I would prefer the latter ("for all $i, j\in\{\dots\}$"). But your first suggestion means the same; so it is also correct.