# Multiple soft step function

I want to create a function that have multiple (infinite) steps like this one:

$x+\sin x$ But i want to have control of two things: how quickly it increases and when the (soft) steps occur.

For example: for the function $\frac{1}{(1+e^{-x})}$ which has the following graph: We can make the step rise faster by multiplying x by a big number.

One possible way to write such a function is writing it as a sum of previous function: $\sum_{i=0}^4 \frac{1}{1+e^{-(x-i)*5}}$ Unfortunately I can't use this kind of series to solve my problem. How can I obtain such function?

• How about a rotated sine or cosine? – user247327 Nov 20 '17 at 17:59
• What do you mean? – MasterID Nov 20 '17 at 18:00
• He means reflected across $y=x$. – Aqua Nov 20 '17 at 18:06
• But then it won't be a function anymore because for a single x it will have multiple values. I will try to rotate 45 degrees and check its properties. – MasterID Nov 20 '17 at 18:08

I would glue together many stair steps like this one, $\dfrac1{1+e^{-x}}$: to give: I used the function

$$f(x) = h\left(\left\lfloor\left(p x-k\right)-\frac12\right\rfloor+\frac{1}{2m}\left(\frac{1}{1+e^{-2\alpha r(x)}}-\frac12\right)+1\right)$$ where $$r(x)=\left(\left(p x-k\right)-\frac12\right)-\left\lfloor\left(p x-k\right)-\frac12\right\rfloor-\frac12$$ and $$m=\frac{1}{1+e^{-\alpha}}-\frac12.$$

It looks a bit complicated, but it is really just gluing together pieces of stair steps. It passes through the point $(k,0)$, and you can adjust the parameters:

$h$: height of step
$p$: horizontal scaling
$k$: horizontal offset
$\alpha$: sharpness of step

In the above picture, $(h,p,k,\alpha) = (\frac25,2,0,10)$.

• Any chance of making the function differentiable? I forgot to say it =( – MasterID Nov 20 '17 at 20:26
• @MasterID Hmm. Perhaps there's a way to smooth it out. What do you need this for? – Théophile Nov 20 '17 at 21:37
• Sorry, I couldn't answer yesterday. I'm trying to solve discrete logarithm by converting to an continuous problem. If i represent any number B by a function B(x) = exp(10*sin^2(xPi/2 * 1/b)) i will have a periodic function that will be near 0 all the time, except when near 'b' which will go to 1. If C(x) = exp(10*sin^2(xPi/2 * 1/c)). MOD(x) = C(x)+B(x) then we will have an function which the distances (lets call it a A) of gaussians can represent A = B (mod C) or -A == B (mod C). I need this step function to somehow represent powers B and then try to find A=B^k (mod C) – MasterID Nov 21 '17 at 9:15