2

I have a hard time trying to come up with a formal way of writing the following problem. Basically I would like to find a value that corresponds to a certain rank (this certain rank might not be an integer). Here's an example:

I have a vector of numerical values, $x$. e.g., $x=(1,-5,100,0,1000)$

I can rank the absolute values of $x$. e.g., $rank(|x|)=(2,3,4,1,5)$

Suppose I am given a threshold value $t$ for ranks. e.g., $t=2.2$

I would like to know a value $x_{t}$ which corresponds to $floor(t)$. e.g., $x_{t}=1$

It was easy to write in a code: $x_t = x[rank(abs(x)) == floor(t)]$. But I'm unsure how to write it in more formal notation.

I hope it makes sense and let me know if I need to clarify anything.

PS: I'm also unsure what tag this should have. Sorry about that!

1 Answers1

2

Is $x_t$ well-defined in general? If your vector was $(1,-5,100,-1,1000)$ instead, what would be the value for $t=2.2$? I see both $1$ and $-1$ as candidates, as they are tied for 1-2 spots in absolute value ranking.

In a mathematical text, $x_t$ would not be described by a single formula, but rather by a couple of sentences:

Let $j(t)$ be the index $j$ such that $\#\{i: |x_i|\le |x_j|\}=\lfloor t\rfloor$. Then $x_t=x_{j(t)}$.

In the above description, $\#$ is the number of elements in the set. With $t=2.2$, using your vector as an example, $j(t)=1$ because the set $ \{i: |x_i|\le |x_1|\}$ is $\{1,4\}$ and therefore has two elements.

As I said at the beginning, when two or more components of the vector share the same absolute value, $j$ may be undefined.

40 votes
  • 9,736
  • Thanks! I was hoping to make it more concise. In this way, I'm defining a function $j(t)$. Potentially, I may get multiple items with an identical value. In your example, 1 would become $x_t$. If I have a vector $(1,-1,1,2,3)$ with $t=2.2$, I would still get $x_t = 1$ – Code2Math Jul 25 '13 at 16:18
  • @Code2Math Do you mean that in the situation of a tie, the positive value is to be chosen for $x_t$? – 40 votes Jul 25 '13 at 19:31
  • Thinking about it, ties doesn't matter (I'm actually only taking the absolute value). But the on the other hand, could I just write something like: $x_t$ is such that $#{i:|x_i|\leq x_t}=\lfloor t \rfloor$. What's the point of taking the index $j$ and then assign $x_t = x_{j(t)}$. Sorry for my ignorance! – Code2Math Jul 25 '13 at 19:47
  • @Code2Math My made a mistake above, writing $|x_i|\le x_j$ where I actually meant $|x_i|\le |x_j|$. – 40 votes Jul 25 '13 at 20:36
  • @Code2Math If the vector is $(1,-1,2,3,4)$ and $t=2.2$, why should the output be $1$? Both $1$ and $-1$ have the same rank in terms of absolute values. – 40 votes Jul 25 '13 at 20:37