1
$\begingroup$

When writing about an algorithm or any mathematical construct, is it permissible to re-use already introduced notation, e.g. to describe a general case?

For example, I am writing about an algorithm and I have defined a sequence $A = {a_1, a_2, ... a_n}$, where I also define $a_i$ as well as $a_j$ to mark points within the sequence, and I defined $i,j \in \lbrace 1,2,...,n \rbrace$.

Now, for another part of the same algorithm, I want to define a Markov matrix $B$, and in there, I want to write "..., for example if state $i$ moves into state $j$, then ...". Note that I am using $i$ and $j$ in context of a general description for this matrix and not in reference to $A$.

Is this permissible, or what are the recommended ways of doing so?

(I am not asking for help in regards to the algorithm, and I could have used any other example. Thus, my question only relates to general advice on how to name variables.)

4 Answers 4

4

I would advise against it: You have so many possibilities for a clear notation, why make it harder for someone who tries to follow your thoughts or risk possible misunderstandings.

Sure, a lot depends on the context (and clarifies itself by it), but generally I would say:

If you ask yourself if this could be understood in a wrong way or possibly confuse the reader - then it likely does and you might want to clarify right from the beginning.

To stay within your example, why not use $k,l$ instead of $i,j$ while addressing your sequence and then you use the indices $i,j$ to address the states of you MC. I'd also recommend to use standard notation and try not to deviate too much from it.

Maybe you'll find this small manual helpful, or the references within.

2

This question is of crucial importance in computer science where the notion of scope of a variable has been extensively studied. In particular understanding the notion of local variable versus global variable is useful even for notation.

For instance, you may write things like:

In this section $n$ denotes a positive integer and $M$ denotes a $n \times n$ matrix (scope of $n$ and $M$: this section).

Let $T = \sum_{1 \leqslant i \leqslant n} M_{i,i}$ and $S = \sum_{1 \leqslant i \leqslant n}M_{i,i}^2$ (the letter $i$ is a local variable in each summation and hence it can be reused without any ambiguity).

Another good practice is to use homogeneous notation. For instance, if $E$ is a set, you may write

for each element $x$ of $E$, $\ldots$

Since $x$ is here a local variable, you may in theory write

for each subset $x$ of $E$, $\ldots$

but it would be much better to write instead

for each subset $X$ of $E$, $\ldots$

and keep using lower case letters for elements and upper case letters for subsets.

Coming back to your example with Markov matrices, if you really feel there is a risk of confusion, you may denote the states by $q_i$ and $q_j$, as it is common practice in automata theory. However, I would not recommend for it in a systematic way, as it is definitely a heavier notation.

1

Depends heavily on the context. If one can unambiguously understand what you mean you are fine. Using i and j to describe two indexes reads very easily, but not when i refers to three different things in one line of reasoning (so using the same symbols in a proof for example). On the other hand, when your indexes start getting subscripts of their own, like $i^h_{k, top}$ then you should stop and reconsider your life.

1

I'd say it depends on how "localized" the different uses of $i$ and $j$ are.

If you had a double summation on one page of your paper that used index variables $i$ and $j$, and on that page you completely finished all the discussion of that summation that required consideration of individual terms, and then on a later page you had a double product of some different set of numbers with index variables $i$ and $j$, I probably wouldn't care.

On the other hand, if you really like to use $a_i$ and $a_j$ to identify terms within one particular sequence, you repeatedly use those two symbols for that similar purpose in many places, then you say something about state $i$ moving to state $j$, and then you remind me about the same $a_i$ and $a_j$ you were discussing just before states $i$ and $j$, I am likely to get very annoyed.

In the worst case you reuse a symbol in a way that makes me misunderstand a formula and wast a lot of time trying to figure out why it didn't make sense to me.

It's hard to say for sure about the example in the question. It depends on how "fixated" $i$ and $j$ became to the first kind of index. It does sound very likely, however, that you might be well advised to change your notation.