Are subscripts 0 or 1 based?

159 Views Asked by At

Being a programmer by nature I can never remember when looking at a math formula if the subscript that indicates which value in a series starts at 0 or 1. I know computer arrays start at 0 so that is my instinct without thinking but noticing 0 is never used in my formula my guess in this case is 1.

In a nutshell: For $X_i$ is the minimum $i$ 0 or 1?

Edit:

My context is that $X_i$ is the $i$th point in a recorded data series. Here is the formula I am using it in if it helps:

$$\sigma(\tau) = \sqrt{\frac{\sum_{j=1}^{N-3n-1} \left[\sum_{i = j}^{n + j + 1} (X_{i+2n} - 2X_{i+n} + X_{i})\right]^2 }{6n^2(N-3n-1)}}$$

2

There are 2 best solutions below

1
On BEST ANSWER

Generally 1. A lot of times they tell you. For example, $\sum_{n = 1}^\infty \frac{\mu(n)}{3^n}$, it tells you right there you start with $n = 1$.

Besides $-\infty$, as the dark knight suggests, some formulas start with 2, but again, they give you enough information to know this is the case, e.g., $\sum_{p \leq N} \frac{1}{p}(p - 1) \ldots$ and then they say something like "where the sum runs over the primes."

There are also instances it might not make a difference, as for example, in the formula for triangular numbers, $T_n = \sum_{i = 0}^n i$, it would make no difference if you started with $i = 1$ instead, except of course it would kind of make $T_0$ undefined.

And for what it's worth, in Wolfram Mathematica, initial subscripts default to 1. If you were to tell it "Sum[MoebiusMu[n]/3^n, {n, Infinity}]," it would understand that n starts at infinity (although I think MoebiusMu[0] is defined in that program, and although that should not make any difference whatsoever to the final sum).

EDIT: Oh, I see. You've got nested sums, kind of like you're in Inception. At the first sum, your iterator $j$ should initialize at 1 (you could start it any value between 1 and $N - 3n - 1$ if you wanted to confuse yourself further; but seriously, start it at 1). Then, when you enter the inner sum, your iterator $i$ starts at the same value as $j$, which is 1. If it helps any, think of it as FOR loops in Basic or C++ or whatever.

0
On

The answer to the general question is "it depends", but in your particular case you have a formula that requires you to know the value of $X_i$ for every integer $i$ such that $1 \le i \le N$. If you have exactly $N$ observations that you place in an array in your computer program, and your computer language names the $N$ elements of that array a[$m$] where $m$ is an integer and $0 \le m \le N - 1$, then you had better use a[$i-1$] as the value of $X_i$.

Since you say you know computer arrays start at $0$, I take it you are working in a language that indexes its arrays as in the previous paragraph, and not one for which the subscripts of a[$m$] would be in the range $1 \le m \le N$.