[Math] How to write a counter in proper notation

notation

I have made a system where I count every hour that meets a certain condition. I would now like to express this in a simple formula but sadly can not come up with a solution. This is what I need.

For each hour where $\theta_{dp} > \theta_{crit}$ add one to DPH. Do this for all hours of the year.

The best I could think of is something like this:

$DPH = \sum^{365}_{j=1} \sum^{24}_{i=1} \left(0 \cdot (\theta_{dp} – \theta_{crit})^{+} \right)!$

This is of cause quite wrong. With the $^{+}$ I try to indicate that the result should only be taken into account if the result of the bracket is positive. Else there is nothing to do. Multiplying any positive result by zero and then take the factorial. I have just included the example to show that I have been pondering the idea for some time but did not get anywhere.

Thanks for any help!

Trying to use the Heaviside function suggested by @Clement C

\begin{equation}
DPH = \sum^{365}_{j=1} \sum^{24}_{i=1}
\begin{cases}
1 & \mbox{if } \theta^{dp}_{j,i} > \theta^{crit}\\
0 & \mbox{if } \theta^{dp}_{j,i} \le \theta^{crit}
\end{cases}
\end{equation}

For some reason this looks incomplete to me. But than i am really not good at this.

Best Answer

There are many functions which you could use.

  • The Iverson bracket, that is, for any proposition $P$ we have

    $$[P] = \begin{cases}1 & \text{ if }P \text{ is true}, \\ 0 & \text{ otherwise},\end{cases}$$

    and in your case we would have $$\mathrm{DPH} = \sum_{h\ \in\ \mathrm{Hours}}\Big[\theta_\text{dp}(h) > \theta_\text{crit}\Big].$$

  • The characteristic function, that is, for any set $A$ we have

    $$\chi_A(x) = \begin{cases}1 & \text{ if }x \in A, \\ 0 & \text{ otherwise},\end{cases}$$ which could be used as follows $$\mathrm{DPH} = \sum_{h\ \in\ \mathrm{Hours}}\chi_A(h)$$ where $$A = \Big\{h \in \mathrm{Hours} \ \Big|\ \theta_\text{dp}(h) > \theta_\text{crit}\Big\}.$$

    In fact sums and integrals of characteristic functions behave like measures, so in fact you could simplify it all into

    $$\mathrm{DPH} = |A| = \Bigg|\Big\{h \in \mathrm{Hours} \ \Big|\ \theta_\text{dp}(h) > \theta_\text{crit}\Big\}\Bigg|.$$

  • The sign function, the heaviside function or other similar, for example $$\mathrm{DPH} = \sum_{h\ \in\ \mathrm{Hours}}\mathrm{Heaviside}\big(\theta_\text{dp}(h)-\theta_\text{crit}\big),$$ although, you may want to look out for the cases where $\theta_\text{dp}=\theta_\text{crit}$.

  • Define your own function using the piecewise notation, for example let $$f(\theta) = \begin{cases}1 &\text{ if }\theta > \theta_\text{crit}, \\ 0 & \text{ otherwise,}\end{cases}$$ and then set $$\mathrm{DPH} = \sum_{h\ \in\ \mathrm{Hours}}f\big(\theta_\text{dp}(h)\big).$$ Alternatively you could define $$g(h) = \begin{cases}1 &\text{ if }\theta_\text{dp}(h) > \theta_\text{crit}, \\ 0 & \text{ otherwise,}\end{cases}$$ and then use $$\mathrm{DPH} = \sum_{h\ \in\ \mathrm{Hours}}g(h).$$

The role of notation is to help the readers understand your idea. You can alter or change it anyway you want, as long as you make it clear for the reader. Finally, don't forget to define any piece or formula that the readers might be unaware of (this is less important for domain-specific papers and essential for texts targeted at general audience).

I hope it helps $\ddot\smile$

Related Question