0
  1. For example, we have a list $\mathcal{L}$ of elements. $\mathcal{L} = [\mathcal{E}_1,\mathcal{E}_2,...,\mathcal{E}_n]$

  2. Each element $\mathcal{E}$ contain two values $x$ and $y$:
    Example: $x = 3$, $y = 10$

  3. I need to sum up the $y$ values from all available $\mathcal{E}$ in $\mathcal{L}$.

    My draft version 1 looks like this: $s = \sum_{i=1}^n \mathcal{E}_{y,{i}}$

  4. The value $y$ should not be greater than $\alpha$. If I add this rule for the $y$ value: if y > alpha: y = alpha

    My modified draft version 2 looks like this: $s = \sum_{i=1}^n \min(\mathcal{E}_{y,{i}},\alpha)$

Is this notation for formally correct, what is the best way to write the requirements (1-4) down? For completeness I guess $\mathcal{L}$ is missing, I am not sure how to include it.

Please let me know if any information is missing.

Ximi
  • 3

1 Answers1

0

This depends on your implementation. So let's fix an implementation. A pair, $P$ which we might write $P=(x,y)\in X\times Y$, is equivalently viewed as nothing more than a function $P:\{1,2\}\to X\cup Y$, with $P(1)\in X$, $P(2)\in Y$. This is frequently abbreviated $P=(P_1,P_2)$. If you wish, you can replace the set $\{1,2\}$ with any two symbols you like, say $\{x,y\}$, but keep in mind that these are just symbols and not variables. In the notation above, we would instead write $P=(P_x,P_y)$.

A list of $n$ elements from a set $A$ then, is nothing more than a function $L:\{1,...,n\}\to A$, such that where again we write $L_i=L(i)$, compatible with the old notation by $L=[L_1,L_2,...,L_n]$, for notational convenience.

But these objects are functions of their indices. If I wanted to access the first element of the $i^{\text{th}}$ pair in a list of pairs $L$, I would write $L(i)(1) = L_i(1)= (L_i)_1$. Where the object referred to by $L(i)$ is itself a function which expects an argument, which is why we have two arguments to the right of $L$ here. It is again standard notation to abbreviate this as $L_{i,1}$.

Now we can compare this paradigm to your writings above.

In your first line, we have defined $L$ as a function/list by asserting that $L(i)=\mathcal{E}_i$. It is clear that $L=\mathcal{E}$ so the $L$ is redundant, and we might as well jut call our list $\mathcal{E}$. Furthermore, you then refer to $\mathcal{E}$ as an element of $\mathcal{E}$, which is not the case. If you wish to refer to a general pair in $\mathcal{E}$ it suffices to write $\mathcal{E}_i$ without specifying $i$.

You then write that $\mathcal{E}_i$ contains two values $x$ and $y$, but this isn't a name which explicitly depends on $i$ in any way, remember that $x$ and $y$ are just symbolic references to $\mathcal{E}_i$'s values. Aside from not making sense because $x$ is not a variable, if you were to write $x=3$, it would be unclear which $\mathcal{E}_i$'s $x$ you were referring to. To correct your example, we would instead write someting like $\mathcal{E}_{1,x}=3,\mathcal{E}_{1,y}=10$.

Finally, we can easily sum over the desired values, because we can easily refer to them. The expression becomes $$s=\sum^n_{i=1}\min(\mathcal{E}_{,y},\alpha)$$

ZKe
  • 800