How do I efficiently take care of the case where I'm taking the mean of a set if the set can be empty?
\(\displaystyle \sum_{i \in A} \frac{b_i}{|A|} \)
The previous equation is not well defined when the set is empty. So I tried this
\(\displaystyle I[ |A| > 0 ]\sum_{i \in A} \frac{b_i}{|A|} \)
But this is still undefined! Is there anything I can do to transform the undefined mean to an actual number?
I guess I could use piecewise analysis, such as
\(\displaystyle f(A) = \begin{cases}
\sum_{i \in A} \frac{b_i}{|A|} & \text{if } |A| > 0 \\
0 & \text{if } |A| = 0
\end{cases} \)
However this rapidly becomes cumbersome - if an equation has k potentially undefined means, it means I need to take care of 2^k different cases.
\(\displaystyle \sum_{i \in A} \frac{b_i}{|A|} \)
The previous equation is not well defined when the set is empty. So I tried this
\(\displaystyle I[ |A| > 0 ]\sum_{i \in A} \frac{b_i}{|A|} \)
But this is still undefined! Is there anything I can do to transform the undefined mean to an actual number?
I guess I could use piecewise analysis, such as
\(\displaystyle f(A) = \begin{cases}
\sum_{i \in A} \frac{b_i}{|A|} & \text{if } |A| > 0 \\
0 & \text{if } |A| = 0
\end{cases} \)
However this rapidly becomes cumbersome - if an equation has k potentially undefined means, it means I need to take care of 2^k different cases.
Last edited: