# Looking for a continuously differentiable function that's bounded between 0 and 1, is 0 at 0, and approaches 1 as x approaches $\pm\infty$

Is there a continuously differentiable function $f:\mathbb{R}\rightarrow\mathbb{R}$ where

• f(0)=0
• $\lim\limits_{x\rightarrow\infty} f(x) = 1$
• $\lim\limits_{x\rightarrow-\infty} f(x) = 1$
• f(x) increases monotonically when $x\geq 0$
• f(x) decreases monotonically when $x\leq 0$

If possible, I'd be nice to have the rate at which it saturates be tuneable and a double bonus if the function is twice continuously differentiable.

Basically, I'm modeling an efficiency. The process gets more efficient as the magnitude of the input becomes large. As such, I'm looking for a function that can approximate this behavior for a few tests.

$$f(x) = 1 - e^{-x^2}$$ is one. You can tune it by multiplying the exponent by some constant.

Besides Nick's Example, here are three further examples, all of which are infinitely many times differentiable. \begin{align} f(x)&=\tfrac{2}{\pi}\arctan(x^2), \\ g(x)&=\begin{cases}\exp(-1/x^2)&\text{for }x\neq0,\\0 &\text{for }x=0,\end{cases} \\ h(x)&=\cos\left(\pi/(2+x^2\right). \end{align}

• There is indeed an uncountably infinite number of solutions. – NickD Sep 27 '17 at 22:29

Consider a rational function $$f(x)=\frac{P(x)}{Q(x)}$$ The conditions imply the following:

• $P(0)=0$.
• $P$ and $Q$ have the same degree and leading coefficients.
• $Q$ has no zeros.
• The derivative, $f'(x)=\frac{P'Q-PQ'}{Q^2}$, is negative for $x<0$, positive for $x>0$ and vanishes at $x=0$.

Since $Q$ can't vanish, the easiest way to accomplish this seems letting $Q(x)=(x-a)^2+b$, for some real $a$ and positive $b$. Now, $P(x)=x^2+cx$.

Then $$f'(x)=\frac{(2x+c)(x^2-2ax+a^2+b)-2(x-a)(x^2+cx)}{Q(x)^2}$$

By the last condition, this numerator should have degree $1$ and no constant term. This makes $$c-4a+2a-2c=0$$ $$c(a^2+b)=0$$

Since $a^2+b>0$, we have $c=0$ and then $a=0$.

Then $$f(x)=\frac{x^2}{x^2+b}$$

For higher degrees of $P$ and $Q$ there should be more solutions.