A simple function equation I come from a programming background and I can’t find a simple math function. The request might seem strange, but I needed it a graphical context to alter some points locations:
I need a function $f(x) = y$ defined for $x \ge 0$ such that:


*

*$f(x) \in [0, x)$

*$f(0) = 0$

*$f(x) \approx x$ as $x\to \infty$.

*It has to slowly grow at first — sort of like $x^2$ — and then get closer and closer to x.


The simplest equation form that satisfies this restrictions will do.
I tried to plot this so that I can make myself better understood:
http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427eo8stqhpe1s

Actual values don’t matter, just the shape of the plot.
None of the basic functions (and combinations of them) that I tried were doing this (e.g. $x^2, \log x, \sqrt x, 1/x$).
 A: This one fulfills your requirements:
$$f(x)=\frac{x^2+x^3}{1+x+x^2}.$$
We have:
$$\forall x>0,\ 0<f(x)<x$$
$$f(0)=0,$$
$$f(x)-x^2=-\frac{x^4}{1+x+x^2}$$
so that $f(x)$ and $x^2$ are very close for small values of $x$, and
$$f(x)-x=-\frac{x}{1+x+x^2}$$
so that $f(x)$ and $x$ get closer and closer as $x\to+\infty$.
It's also cheap to compute with 2 additions, 2 multiplications and 1 division if you proceed thus:


*

*Compute $x^2$ (1 mult) and $x+x^2$ (1 addition); set $a=x+x^2$.

*Compute $x\times a$ (1 mult); set $b=x\times a$.

*Compute $1+a$ (1 addition); set $c=1+a$.

*Compute $b/c$ (1 division): that's $f(x)$.

A: You could use a common hyperbola $y = \sqrt{a^2 + x^2} - a$.
Example with $a = 10$:

A: You can use a weighting function $w(x)$ that allows you to create a mixture between the functions $x^2$ and $x$, as $\frac{x^2+w(x)x}{1+w(x)}$. Ensure $w(0)=0$ so that the initial behavior is $x^2$  and $w$ growing sufficiently fast that the term $x$ supersedes it.
$$w(x)=x^3\to y=\frac{x^2+x^4}{1+x^3}.$$
$$w(x)=e^x-1\to y=\frac{x^2+x(e^x-1)}{e^x}.$$

Note that if you really want to reach $y=x$ (and not $y=x-c$), there must be an inflection point.
A: Consider the derivative of your function.
It has to be positive,increasing and $f'(x→inf)=1$
$f'(x)=tanh(x)$ fits.
$ \int \tanh(x) dx = \log (\cosh (x))+c$
Since we want $f(0)=0$ 
$\log (\cosh 0)+c=0\Leftrightarrow  c=0$
Therefor $f(x)= \log (\cosh (x)) $ works.
A: Using your data, I found that $y=a x^b$ fits very well. My results are $a=0.008755$ and $b=3.134091$. The corresponding $R^2=0.999$.
This is a very flexible form.
A: A simple function satisfying all above mentioned restrictions is:
$$f(x) = x \left( 1- \frac{1}{1+x} \right)$$
How to construct such a function?


*

*$f(x)$ should behave like $x$ for $x \rightarrow \infty$ and for $x \gt 0$ it should map into the interval $[0,x)$ which mean $0 \leq f(x) \lt x$. So let's set up the function as
$$f(x) = x \left( 1- g(x) \right)$$
To satisfy the above mentioned restriction we conclude:
$$g(x) \rightarrow 0 \mbox{ for } x \rightarrow \infty \mbox{ and } g(0) = 1 \mbox{ and } 0 \lt g(x) \lt 1 \mbox{ for } x \gt 0$$

*A simple function that satisfies all this is
$$g(x) = \frac{1}{1+x}$$

*Near $0$ the function $f(x)$ behaves like $x^2$ because for $|x| \lt 1$ we have $\frac{1}{1+x} = 1 - x + x^2 - x^3 +- \cdots$ (geometric series). So
$$f(x) = x\left( 1 - ( 1 - x + x^2 - x^3 +- \cdots) \right) = x^2 - x^3 +- \cdots \approx x^2 \mbox{ for } x \mbox{ close to }0$$

