A function $f$ such that $f(x)$ increases from $0$ to $1$ when $x$ increases from $0$ to infinity?

I am looking for a function f(x) with a value range of [0,1].

f(x) should increase from 0 to 1 while its parameter x increases from 0 to +infinity.

f(x) increases very fast when x is small, and then very slow and eventually approach 1 when x is infinity.

Here is a figure. The green curve is what I am looking for:

enter image description here

Thanks.

It would be great if I can adjust the slope of the increase. Although this is not a compulsory requirement.


I think this should work well for your purposes: $$ f(x) = \frac{x}{x + a} $$ Where $a$ can be any number bigger than $0$. The smaller $a$ is, the sharper the increase will be.

ADDENDUM: if you want to extend this to an odd (and continuously differentiable) function, simply take $$ f(x) = \frac{x}{|x| + a} $$


Here are two simple functions with slope $k$ at $x=0$, for some $k>0$:

$$f(x) = 1-e^{-kx}$$

and

$$g(x) = \frac{2}{\pi}\arctan(\frac{\pi}{2}kx)$$

The first of these approaches $1$ more quickly than the second.


One I use very often is : $$ \tanh x = \frac{\sinh x}{\cosh x} = \frac {e^x - e^{-x}} {e^x + e^{-x}} = \frac{e^{2x} - 1} {e^{2x} + 1} = \frac{1 - e^{-2x}} {1 + e^{-2x}}$$

The increase at the begining around 0 is "only" linear but can do the work. and you can choose the slope at $x \mapsto 0$ Hyperbolic tangent


I'm surprised no one has mentioned erf(x) aka the "Error Function", defined roughly as the normalized area under the bell curve as a function of the upper limit of integration. For x > 1, it satisfies your requirement and also has a slope that is easily controlled (and made arbitrarily large at 0) by the width of your Gaussian.


$f(x) = 1 - \exp(-x/\epsilon)$ for $\epsilon > 0$ small will do.