I need to write a formula with summation in a general case allowing also the case with not incremental indexing. Example: $ \sum_{i=\underline{i}}^\bar{i}$ where can be incremental$i=0,1,2,\cdots,\bar{i}$ or $i=0,3,5,9,\bar{i}$. Can you suggest me the correct general notation?
2 Answers
Let $S$ be the set of elements on which you want to sum, then you can use the notation $$\sum_{k\in S} \ldots$$
A few examples:
let $S=\{1,3,5\}$, then $\sum_{k\in S} 2k = 16$.
Let $S=\Bbb N\setminus\{0\}$, then $\sum_{k\in S} \frac{1}{k^2}=\frac{\pi^2}{6}$
Let $S=\{2k\mid k\in \Bbb N\}$ and $a_n=1$ if $n$ is odd, $a_n=0$ if $n$ is even, then $\sum_{k\in S}a_n =0$
etc..
NOTE Note that this notation can be useful when you have several sums. For example if $A\in \Bbb R^{m\times n}$ and $[m]=\{1,\ldots,m\},[n]=\{1,\ldots,n\}$, then $$ \sum_{i=1}^m\sum_{j=1}^n A_{i,j}=\sum_{i\in [m],j\in [n]} A_{i,j}=\sum_{(i,j)\in [m]\times [n]} A_{i,j}.$$ You can also use when you have $d$ sums, for example if $x^i\in \Bbb R^{n_i}$ for $i=1,\ldots,d$ and $[n_i]=\{1,\ldots,n_i\}$, then $$\sum_{j_1\in [n_1],\ldots, j_d\in [n_d]}x_{j_1}^1\cdot x_{j_2}^2\cdot\ldots\cdot x_{j_d}^{n_d}$$ is the sum of all entries of the rank 1 tensor $x^1\otimes x^2\otimes \ldots \otimes x^d$. More generally, If $S_1,\ldots,S_d$ are some sets over which you want to sum an expression, then $$\sum_{j_1\in S_1} \sum_{j_2\in S_2} \cdots \sum_{j_d\in S_d} f(j_1,\ldots,j_d)=\sum_{j_1\in S_1,\ldots, j_d\in S_d}f(j_1,\ldots,j_d).$$
-
$\begingroup$ thank you! suppose I have a double summation: $\sum_{i\in H}\sum_{j\in p}$ where $p$ changes in function of $i$ (different starting points incremental, not incremental) $\endgroup$– MarcoMar 27, 2015 at 14:40
-
$\begingroup$ @Marco I edited my answer. Does it answers your question? $\endgroup$– SurbMar 27, 2015 at 14:48
-
$\begingroup$ thank you. This is my case: $H=\{1,2,3\}$ and $p(H)$. For example: $p(1)=\{1,2,3,4\}$ and $p(2)=\{3,8,9\}$. So, it is correct if I use this notation? $\sum_{i\in H}\sum_{j\in p(H)}$. It would solve my problems... $\endgroup$– MarcoMar 27, 2015 at 14:53
-
$\begingroup$ @Marco The correct notation in this case would be $\sum_{i\in H}\sum_{j \in \color{red}{p(i)}}\ldots$. $\endgroup$– SurbMar 27, 2015 at 14:54
-
$\begingroup$ you're perfectly right. thank you very much! $\endgroup$– MarcoMar 27, 2015 at 14:59
There are two notations for sums:
$$\sum_{i=i_0}^{i_1} f(i)$$ Sums over all integers such that $i_0\le i\le i_1$, where $i_0, i_1 \in\mathbb Z$.
$$\sum_{i\in I} f(i)$$ Sums over all elements of (the index set) $I$.
So in general there are two options: $1+3+5+\ldots$ can either be written as $$\sum_{i=0}^k (2i+1)$$ (So we adjusted the summands) or as $$\sum_{i\in\{1,3,\ldots, 2k+1\}} i$$ (We changed to summation over a set)
Your particular sequence of $i$'s does not lend itself to a canoncal transformation, so $$\sum_{i\in\{0,3,5,9,\bar i\}} f(i)$$ would be the way to go.