# Iverson Bracket / Conditional Sum of a string

I'm trying to turn calculations that I've been using on a data set into mathematic notation to write it down in a research paper.

One of my calculations creates a factor that determines how often a certain value (in this case the geographic location of $r$), appears in a string $s$.

As a definition I wrote:

$\Gamma$ is defined for a release $r$ as the number of its occurrences in the sequence $s$ divided by count of all its elements $n$. After readingh trhough various articles I based my notation to cases where people used Iverson brackets (Mathematical notation for a conditional sum) and came up with following:

$$\Gamma(r_{iso}) = \frac{\sum_{i=1}^{n} \Big[ s_{i} = r_{iso}\Big]}{n}$$ \begin{align*} \text{where}\\~r_{iso} &= \text{release origin of r} \\ s_{i} &= \text{sequence of all accounted geographic locations} \end{align*}

Reading this, would a math ninja scream out of agony or does this seem about right? Are there other / better ways of expressing this definition? Thanks for your help!

• It's cumbersome as a definition. You can use $|\{s_i:s_i=r_{iso}\}|$ or $\#\{s_i:s_i=r_{iso}\}$ instead.
– A.S.
Mar 17, 2016 at 18:27

It wouldn’t bother me, though if I took this approach I’d probably write it

$$\Gamma(r_{iso})=\frac1n\sum_{i=1}^n[s_i=r_{iso}]$$

instead. Unfortunately, quite a few people are still unfamiliar with Iverson brackets, so it would probably be better to use a more familiar alternative. Perhaps the simplest is

$$\Gamma(r_{iso})=\frac1n\big|\{i:s_i=r_{iso}\}\big|$$

or

$$\Gamma(r_{iso})=\frac{\big|\{i:s_i=r_{iso}\}\big|}n\;,$$

depending on person preference.