Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose you have values and classify them in a histogram. In pseudo code this may look like this:

foreach value
  foreach bucket
    if(value > bucket.lowerBound && value <= bucket.upperBound)
      bucket.count = bucket.count + 1

Is there a mathematical notation for this selection task?

Suppose $i$ is an index denoting the bucket and $j$ an index of the values. Does a nice compact notation exist for writing the count $c_i$ in bucket $i$ as a function of the lower $l_i$ and upper $u_i$ bounds of bucket $i$, akin to

$ c_i = ... someNotation (v_j, l_i, u_i)$

Or maybe a matrix notation could better fit? With $C$ the vector of counts, $V$ the vector of values and $U$,$L$ the vectors of bounds.

$C = ...$

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The indicator function is defined as \begin{align} \mathbf{1}_A(x) :=\begin{cases} 1 &\text{if } x \in A, \\ 0 &\text{if } x \notin A. \end{cases} \end{align} So you could rewrite your expression as \begin{align} c_i = \sum_{j} {1}_{[l_i,r_i]}(x_j) \end{align} But I don't know, whether there is a matrix notation.

Edit: It might be a problem that you check for $\quad left < x \leq right$ and not $ left \leq x \leq right$

share|improve this answer
    
Thanks for that. About your edit, I need to avoid duplicate counting so need to have strict inequality on one side: left<x≤right –  Philipp Mar 5 '13 at 13:59
    
Ah okay, you could write it as $1_{(l_i,r_i]}$ but this does not really change the fact that you have no matrix representation. –  sonystarmap Mar 5 '13 at 14:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.