# Example of a function that behaves like another function

I need a function $f(x)$ with the following properties -

1. It should be monotonically non-decreasing.
2. For $x \geq 1$, $x + \frac{1}{x} - f(x) < \epsilon$ where $\epsilon$ is an extremely small positive real number.
3. It should look simple. I know this sounds like a very vague requirement, but I hope the meaning of "simple" is clear to some extent. For example, the function should definitely not have a piecewise definition. One should be able to write it by using not more than 15 characters, etc. etc.

Can anyone think of such a function? It's fine even if the above requirements are satisfied only for positive values of x.

-
$f(x)=x+1$ works. –  Philippe Nadeau Sep 27 '10 at 7:44
$f(x) = x + \frac{1}{1+|x-1|}$ satisfies (1) and what you probably mean by (2). But maybe for (3) you want something differentiable? –  Bjørn Kjos-Hanssen Sep 27 '10 at 8:38
What's wrong with $f= x + \frac 1 x - \frac \varepsilon 2$ ? –  Piero D'Ancona Sep 27 '10 at 10:31
@Piero - The function you mention is not monotone non-decreasing over $(0,\infty)$ as required. –  Moshe Schwartz Sep 27 '10 at 12:26
Right. He wants the inequality over $x>1$ but the monotonicity over $x>0$. –  Piero D'Ancona Sep 27 '10 at 12:43

This may be more than 15 symbols, but $$f(x)= x + \frac{1}{1+(x+\delta-1)^{2n/(2n-1)}}$$ where $\delta>0$ is small and $n$ is large. For $n=2$ and $\delta=1/10$ it looks like this:

EDIT:

# Motivation

The idea is that we want $y=x+g(x)$ where $g$ is a bell curve of some sort, say $g(x)=e^{-x^2}$. Something that is a little more reminiscent of $1/x$ is $$g_{1,1}(x)=\frac{1}{1+x^2}$$ but the $x^2$ term means that the rate of approach to $1/x$ is not so good. On the other hand $$g_{\infty,0}(x)=\frac{1}{1+|x-1|}$$ would be perfect, were it differentiable. The formula $$g_{n,\delta}(x)= \frac{1}{1+(x+\delta-1)^{2n/(2n-1)}}$$ gives something that looks like the latter from far away ($n=\infty$, $\delta=0$), and like the former from up close ($n=\delta=1$). Note that $|a|=(a^2)^{1/2}$.

EDIT #2:

# Or...

Here is a plot of Gowers' more general solution (in another answer to this question), for this specific case, together with the original curve:

-
Awesome. This works, thanks! Can you give me some idea about how you came up with this by the way? –  Vinayak Pathak Sep 27 '10 at 17:45

Here's a general way of doing something like this. One way we could achieve what we want is to multiply the function x+1/x by something that's very like a step function -- 0 up to 1 and 1 from then on.

Now to get a step function in a nice clean way a simple method is to take a Gaussian that's centred at 1 and has very small variance, and integrate it. Multiplying the resulting function by x+1/x should do the trick.

If you don't count the integral of $e^{-x^2}$ as nice, then you have to find another function that looks like a step function. Something based on $\tan^{-1}(x)$ should do the trick. At a guess, $(\tan^{-1}(1000(x-1))+\pi/2)/\pi$ ought to be OK.

-
The hyperbolic tangent would probably work nicely as well. –  J. M. Sep 28 '10 at 3:10