Notation – Mathematical Notation for a Conditional Sum

notation

I'm looking for the correct way to define a sum of all elements in a set that fullfill a certain condition.

Example:
$$
n(A) = \frac{\sum_{F \in A}{
\begin{cases}
A_F\text{ is }\mathrm{NULL} & w_F\\
\text{else} & 0
\end{cases}}}{\sum_{F \in A}{w_F}}
$$

A is to supposed to be a record with a number of fields $F$. $A_F$ is the value of field F in the record A. $w_F$ is a weight associated with the Field $F$. I want to calculate how much percent of the record is NULL weighted according to $w_F$.

What I want to know is if this below is a valid way to formulate this or if there is a better way.

If someone has some pointers on a more formal / mathematical notation for database/records I would also be very grateful.

Thanks!

Best Answer

Although I don't think it is quite mainstream, but you could look into Iverson Notation. In short, you have a bracket and inside you write a condition. The bracket value is 1 if the condition holds, otherwise it's 0. Its most popular usage was in Concrete Mathematics (by Knuth et al).

$$ n(A) = \frac{\sum_{F \in A}{w_F[A_F \neq NULL]}}{\sum_{F \in A}{w_F}} $$

Related Question