How to write an equation that started with for each where

42 Views Asked by At

First of all, it was difficult to find the proper title for my question. Basically, I would like to write an equation for the following:

For each branch $b_i$ where i in 1 to n, the BEC value for that branch is

$$\sum_{l=1}^{w} r_l \ \forall \ r_l \in \left \{ 0, 1 \right \}$$

where w is the number of runs and $r_l$ is whether the branch $b_i$ has been executed in that run (i.e., = 1) or not (i.e., = 0).

To write that as an equation, I did the following:

$$\forall \ b_i \ where \ i \in \left \{ 1, \dots, n \right \} BEC_i = \sum_{l=1}^{w} r_l \ \forall \ r_l \in \left \{ 0, 1 \right \}$$

I'm not quite sure if this equation looks fine or not.

Can someone please help me in writing the proper equation?

1

There are 1 best solutions below

0
On

If you're writing for computer science, you can use $[1..n]$ for set notation and "such that" (s.t.) instead of where:

$\forall b_i$ s.t. $i \in [1..n] : $ ...

I would also rearrange the equation so that the quantifier is placed ahead of the sum:

$\forall b_i$ s.t. $i \in [1..n] : \forall r_l \in \{0, 1\} : BEC_i = \sum_{l=1}^w r_l $

Some computer scientists use colon to specify the domain, and dot to separate the statements: $\forall b_i: i \in [1..n] \cdot \forall r_l: r_l \in \{0, 1\} \cdot BEC_i = \sum_{l=1}^w r_l $

Alternatively, the quantifiers can be merged.

$\forall b_i, r_l \cdot BEC_i = \sum_{l=1}^w r_l$, such that $i \in [1..n], r_l \in \{0,1\}$