I want smooth step function, which is changing from a to b while x changes from 0 to 1, and I want to control both slope and step location.

enter image description here

Which is the simplest formula for this?

  • $\begingroup$ looks similar to $\arctan(x)$ or $erfc(x)$ except they have infinite base. $\endgroup$ – gt6989b Oct 22 '13 at 17:50
  • $\begingroup$ I like that drawing - artistic. $\endgroup$ – onepound Jan 24 '19 at 12:34

I think I have exactly what you want (see the manipulator perrycioc below!). I took the logistic function, $$P(t) = \frac{K P_0 e^{rt}}{K + P_0 \left( e^{rt} - 1\right)}.$$ To this I introduced a constant $a$, and then adjusted $K=(b-a)$, took $P_0$, and adjusted that to be $P_0=\frac{b-a}{2}$. Lastly, to control the step location, we can let $t=x-c$. The $r$ term already controls the slope, and so the result is,

$$f(x)=\frac{\frac{ (b-a)^2}{2}\cdot e^{r\cdot (x-c)}}{(b-a)+\frac{ (b-a)}{2} \cdot \left(e^{r (x-c)}-1\right)}+a.$$ Surprisingly enough, this cleans up to be the nice compact function, $$f(x)=\frac{a \cdot e^{c r}+b \cdot e^{r x}}{e^{c r}+e^{r x}}.$$ Parameter descriptions:

  1. $a$ and $b$ correspond to your description, with $a<b$.

  2. $r \geq 0$ changes the "slope".

  3. $c$ acts as the step location shifter corresponding to the $x_1,x_2$ in your graph.

While the function is still asymptotic, and still has sigmoid symmetry (not sure if you wanted to destroy that), the result is that you can pretty much put this anywhere on the plane, and do exactly what you want.

I made this manipulator for you, which I will affectionately call the perrycioc function. You should be able to vary the parameters in browser and see how it goes. Note that I have left both the initial form and the simplified form here, so you can manipulate either and see that they are exactly equivalent.


| cite | improve this answer | |

Take a look at Sigmoid functions. In particular, try logistic curves

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.