[Math] try to create a more linear part in a sigmoid curve

exponential function

I want to create a function for a curve which is similar to a sigmoid curve but the center part is linear. That curve must pass through 2 points (-1.5,20) and (1.5,80). The range for y value is [0,100]. I have create two functions which are shown in the figure below.

http://i827.photobucket.com/albums/zz197/koifish1987/curve_zpsaju4fxhn.jpg

sigmoid curve: $y = \frac{{100}}{{1 + {e^{ – \frac{{\ln 4}}{{1.5}}x}}}}$

linear line: $y=20x+50$

I want to make the sigmoid curve (black) closer to the linear line (red). How can I change the sigmoid function to achieve that? Or is there any function which yields the similar curve shape and more linear in the center?

Best Answer

You can add terms in the exponent to cancel higher derivatives at the origin. They need to be antisymmetric, and they shouldn't mess up the behaviour at infinity. Powers of $\sin x$ satisfy those requirements. To cancel the third derivative:

$$ \frac1{1+\exp\left(-x-\frac1{12}\sin^3x\right)}=\frac12+\frac x4+O\left(x^5\right)\;. $$

To cancel the fifth derivative:

$$ \frac1{1+\exp\left(-x-\frac1{12}\sin^3x-\frac{13}{240}\sin^5x\right)}=\frac12+\frac x4+O\left(x^7\right)\;. $$

And so on. Here's a plot of the second version.

This comes at a price – forcing the function into an "unnatural" linearity at the origin while keeping it analytic causes slight oscillations elsewhere. Of course, if you don't care about analyticity, you should just splice a linear function into a sigmoid.

P.S.: I was assuming that you want to keep the asymptotic behaviour roughly unchanged. If you don't care about that, you can do it more simply:

$$ \frac1{1+\exp\left(-x-\frac1{12}x^3\right)}=\frac12+\frac x4+O\left(x^5\right)\;. $$

The plot looks a lot like what you wanted, but it converges to the limit more rapidly than a sigmoid.

The next step in that direction would be

$$ \frac1{1+\exp\left(-x-\frac{x^3}{12}-\frac{x^5}{80}\right)}=\frac12+\frac x4+O\left(x^7\right)\;. $$

And, since you wanted to have an $x^7$ term for rapid convergence, here's the next step, too:

$$ \frac1{1+\exp\left(-x-\frac{x^3}{12}-\frac{x^5}{80}-\frac{x^7}{448}\right)}=\frac12+\frac x4+O\left(x^9\right)\;. $$

At this stage, the plot looks very linear indeed – if you go any further, you might as well use a linear function with cut-offs at both ends instead :-)