# Mapping a variable having very vast range to the interval (0,1)

I am trying to get a continuous mapping from (0,∞) to (0,1). What would be a good mapping?

Context:
I need to rank tuples based on values of two of their attributes a and b. a increases very steeply and b much slower. To accomodate both of them in ranking, I am generating c=a*b and am using that for ranking. c could vary from sub-1 values to a few billions. this makes comparison very difficult. I tried log10(c)..while that helps in reducing the range significantly, having a proper way to map the values to (0,1) would help. I am trying to look for a function to map c to (0,1) that would have a good spread over entire range of the iterval (0,1).I considered sigmoid, but then I thought since all values are psoitive, sigmoid values would be restricted to (0.5,1)..so had to drop that idea..

-
$x\mapsto x/(1+x)$. –  Did Apr 12 '12 at 11:32
The one proposed by Didier seems really good. Perhaps you could provide us with details concerning what you require of your mapping. Since you posted it under the "numerical-methods" tag, I suppose you want it to be well-conditionned and rapidly computed (here Didier's example is perfect), but perhaps there is something else ? –  Samuel T Apr 12 '12 at 11:45
Yet another: $x\mapsto 1-e^{-x}$. –  Brian M. Scott Apr 12 '12 at 11:55
You could multiply the sigmoid by $2$ and subtract $1$ to normalize it to $(0,1)$. –  Brian M. Scott Apr 12 '12 at 12:07
@Didier Thanks Didier. I should have been more specific..I am looking for a function that would not only map to (0,1) but would also have a good spread over that interval. x/(1+x) does not satisfy this latter requirement. –  Aadith Apr 12 '12 at 12:38

## 2 Answers

$\displaystyle f(x) = \frac{1}{x+1}$. The endpoints give it away: we'd like $\infty$ to go to 0 or 1. Well, we can do $\infty$ going to 0 easily by $x \to \frac{1}{x}$. But this function doesn't work near 0. Ah, we can shift it along.

-
Or for that matter $f(x)=\dfrac1{(x+1)^a}$ for any $a>0$. –  Brian M. Scott Apr 12 '12 at 11:57

An obvious one would be x going to $\frac{\tan^{-1}{x}}{\pi/2}$, but you may prefer something else depending on more info you may have about the variable.

-
I suppose most of the sigmoidal functions ($\arctan$, $\tanh$, $\mathrm{erf}$, etc...) work nicely, with suitable normalization... –  Ｊ. Ｍ. Apr 14 '12 at 4:34