1

I want to write a math formula that represents the average of non zero value e.g. if I have 4 numbers, one of them is zero, then the sum of the numbers will be divided by 3. Is it correct to say:

$$ \frac {\sum_{k=1}^{4} x_{k}} {|x_{k} > 0|} $$

F A
  • 31
  • No, it's not meaningful notation as written; $k$ is an index bound to the sum in the numerator, but what does it mean in the denominator? A better way to write it would involve the cardinality of the set of non-zero values, e.g. $$\frac{\sum_{k = 1}^4 x_k}{|{k : x_k > 0}|}.$$ –  Nov 13 '18 at 19:26
  • Also, I really don't see a reason for the downvotes here; it's a reasonable question and involves a clearly stated and common misunderstanding.... –  Nov 13 '18 at 19:28

1 Answers1

1

I think what you want is the following:

$$\frac{\sum_{k=1}^{4} x_{k}}{\sum_{k:x_{k} \neq 0} 1}.$$

You could alternatively define a set $S$ such that

$$S = \{k: x_{k} \neq 0\}$$

and then sum over this set so that you would have

$$\frac{\sum_{k=1}^{4} x_{k}}{\sum_{S} 1}.$$

Note that adding zeros to the sum will not change the numerator. However, you need to have at least one non-zero value $x_{k}$ for this to make any sense.