What is the notation for identifying that the result of a loop is a vector?

171 Views Asked by At

I want to express that I loop over k vectors $s_1 \dots s_k$ and so some calculation with them in function f. The output of f is a scalar, and together these k values form a new vector a. I want to show in the formula that we do this for k steps, as this is important for the reader to understand.

For a summation, we would normally write this:

$a = \sum_{i=1}^k f(s_i)$

But the output shouldn't be a sum, but a vector. What is the correct notation here? Is there simply a symbol I can use instead of the summation symbol, or do I have to rewrite the formula?

2

There are 2 best solutions below

0
On BEST ANSWER

You can define $\mathbf{a}$ by (I use bold font here to indicate the vectors):

$$\mathbf{a} = (a_1, \ldots, a_k),$$

where $a_i = f(\mathbf{s_i})$ for $i = 1, \dots, k$.

In a shorter form:

$$\mathbf{a} = (f(\mathbf{s_1}), \ldots, f(\mathbf{s_k})).$$

0
On

You can use the vectors $e_i=(0,...,0,1,0,...,0)$ which in the i-th spot there is $1$ and $0$ everywhere else. So you can write your sum as: $$a=\sum_{i=1}^kf(s_i)\cdot e_i=f(s_1)\cdot(1,0,...,0)+f(s_2)\cdot(0,1,0,...,0)+\cdots+f(s_k)\cdot(0,...,0,1)$$ $$=(f(s_1),0,...,0)+(0,f(s_2),0,...,0)+\cdots+(0,...,0,f(s_k))$$ $$=(f(s_1),...,f(s_k))$$