TITLE: function for $f: [0,\infty) \to (0,1]$?
QUESTION [6 upvotes]: I'm using R to plot some data and I'd like to transform a distance variable with $[0,\infty)$ to a transparency parameter that accepts inputs $[0,1$]. I'd like $0$ distance to map to $1$ and increasing distances to map to decreasing numbers asymptotically approaching $0$.  It's been a while since I've taken any math so the function I want might be obvious, but can anyone help me out? Bonus if you explain how the function would be scaled to alter the rate that the range approaches $0$.
Thanks!

REPLY [6 votes]: Another possibility is hyperbolic decay, which is slower than exponential decay:
$$f_\alpha(x)=\frac{1}{\alpha x + 1}
$$
Where $\alpha > 0$ is a scaling factor. The larger $\alpha$, the steeper the descent towards $0$.
Here's a plot to compare: