# Looking for a single analytic function with 3 approximately linear 'parts'

I am trying to find a single (i.e. non-piecewise) analytic function $$f(x)$$ with the following features:

$$f(x), f'(x)$$ defined $$\forall x \in \mathbb R$$
$$f'(x) > 0, \forall x$$
$$lim_{x \to - \infty} f(x) = - \infty$$
$$lim_{x \to + \infty} f(x) = + \infty$$
$$lim_{x \to - \infty} f'(x) = m, m \in \mathbb R^+$$
$$lim_{x \to + \infty} f'(x) = m, m \in \mathbb R^+$$
$$f'(\frac 1 2) = n, n \in \mathbb R^+, n \le \frac m {10}$$ # no longer applicable, see edit below #

So a monotonically increasing curve that approximates a straight line of slope $$m$$ almost everywhere, except for a section with much lower slope $$n$$ around $$x = \frac 1 2$$, say for $$0.1 < x < 0.9$$.

How would you go about putting together such a function?

EDIT

I had forgotten to include a condition:

$$f'(x) \ge n, \forall x$$

Also, I realized the function I am looking for becomes symmetric with respect to the origin if I translate $$x$$ by $$- \frac 1 2$$, so in fact the previously mentioned condition on the derivative becomes:

$$f'(0) = n, n \in \mathbb R^+, n \le \frac m {10}$$

EDIT: Taking into account the OP's edits, we have to modify the previous function slightly. I'm merging it with the original answer for clarity.

Assume $$m,n,a > 0, m>n$$. Then, consider the function $$f(x) = \int_0^x \left(m-(m-n)e^{-\frac{u^2}{a^2}}\right) du = mx-(m-n)a\frac{\sqrt{\pi}}{2} \ \text{erf}\left(\frac{x}{a}\right)$$

Thus, we get for $$f(x)$$

1. As $$\text{erf}(-\infty)$$ is finite, $$\lim_{x\to-\infty} f(x) = -\infty$$
2. As $$\text{erf}(\infty)$$ is finite, $$\lim_{x \to \infty} f(x) = \infty$$

Also, we have $$f'(x) = m-(m-n)e^{-\frac{x^2}{a^2}}$$. This gives for $$f'(x)$$

1. For all $$x$$, as $$e^{-\frac{x^2}{a^2}} \le 1$$, we get \begin{align} f'(x) &= m-(m-n)e^{-\frac{x^2}{a^2}} \\ &\ge m-(m-n)\\ &=n \end{align}
2. $$f'(0) = m-(m-n)e^{-\frac{0^2}{a^2}}= m-(m-n) =n \ \ \forall \ x$$
3. $$\lim_{x\to-\infty} f'(x) = \lim_{x\to-\infty} \left(m-(m-n)e^{-\frac{x^2}{a^2}}\right) = m$$
4. $$\lim_{x\to\infty} f'(x) = \lim_{x\to\infty} \left(m-(m-n)e^{-\frac{x^2}{a^2}}\right) = m$$

Note that $$m, n, a$$ here are completely general. So, we can now impose any other conditions, like $$n\le \frac{m}{10}$$ trivially.

• That's brilliant, thank you very much! I realize now that I omitted an important condition: $f'(x) \ge n, \forall x$. And in fact I would need $m$ to be a parameter in the equation. I might try to adapt your equation to achieve this, but if you have any suggestions, as you were so quick finding what I was looking for... Jan 22 at 18:12
• Could you write it down in your main question? It'll both help me and others to answer your question better. Jan 22 at 19:29
• Sure, thanks. Done. Jan 22 at 19:42
• There. I've changed it. Jan 22 at 20:07