Can I modify the following function $y = 1 / (1 + e^{-x})$ such that I can make the curve straighter in the middle?
I would like the function to resemble a straight line until it approaches $0$ or $1$.
Here is an example diagram, the red line is desired:




An Answer: There is no Answer
We could try to generalize the expression a bit to get a "straighter" curve. For example, the expression can be generalized to $\newcommand{\eqd}{\triangleq}$ $\newcommand{\brp}[1]{{\left(#1\right)}}$ $\newcommand{\brs}[1]{{\left[#1\right]}}$ $\newcommand{\brl}[1]{{\left.#1\right|}}$ $\newcommand{\deriv} [2] {{\frac{\mathrm{d}#1}{\mathrm{d}#2} }}$ $\newcommand{\R}{\Bbb{R}}$ $$y \eqd \frac{a_1}{a_2 + a_3e^{-bx}} + a_4$$ And the minimum constraints are $$\begin{align*} \lim_{x\to-\infty}y &= 0 \\\lim_{x\to+\infty}y &= 1 \\\brl{y}_{x=0} &= \frac{1}{2} \end{align*}$$ But under the constraints given/implied, there is no solution; that is, there is no way, under the above constraints, to "straighten" it while holding its "steepness" unchanged. Here is the reason$\ldots$
$$\begin{align*} 0 &= \lim_{x\to-\infty}y \\&\eqd \lim_{x\to-\infty} \brs{\frac{a_1}{a_2 + a_3e^{-bx}} + a_4 } && \text{by definition of $y$} \\&= \brs{0 + a_4 } \\&\implies \boxed{a_4=0} \implies y = \frac{a_1}{a_2 + a_3e^{-bx}} \\\\ 1 &= \lim_{x\to\infty}y \\&\eqd \lim_{x\to\infty} \brs{\frac{a_1}{a_2 + a_3e^{-bx}} + 0 } \\&= \lim_{x\to\infty} \brs{\frac{a_1}{a_2 + 0}} \\&\implies \boxed{a_1=a_2}\implies y = \frac{a_1}{a_1 + a_3e^{-bx}} \\\\ \frac{1}{2} &= \brl{y}_{x=0} \\&= \frac{a_1}{a_1 + a_3e^{-b\cdot0}} + 0 \\&= \frac{a_1}{a_1 + a_3} \\&\implies 2a_1=a_1+a_3 \\&\implies\boxed{a_1=a_3} \\&\implies y = \frac{a_1}{a_1 + a_1e^{-bx}} \\&\implies y = \frac{1}{1 + e^{-bx}} \end{align*}$$
You still have one parameter $b$ that you can change$\ldots$ but changing that will change the ``steepness" of the curve, where here steepness is defined as the derivative $\deriv{y}{x}$ at $x=0$: $$\brl{\deriv{}{x}y}_{x=0} = \brl{\frac{-(-be^{-bx})}{(1+e^{-bx})^2}}_{x=0}=\frac{b}{4}$$ But if you don't want to change that (as you implied in your previous comment), then you have no degrees of freedom left and there is no way to straighten the curve without resorting to changing to what may be considered more "drastic" measures like changing the function altogether.