Translating a sin curve into one that lingers on its maximums longer

509 Views Asked by At

The goal is to create an animation curve mathematically that moves like a sin curve but holds at the extremes. I would also love to be able to parameterize it.

Image showing desired graph behavior In the graph note how the domain spent at either 1 or -1 increases while the function still transitions smoothly in and out of these extremes.

Thus far I have graphs of the following forms with no luck

sin(x)*sin(x)^a
sin(x)^a // This sort of works when a is [0, 1] however I do not like that the derivative appears infinite when y =0
sin(sin(x))
sin(x)+sin(x+a)

I really have not seen a formula that can do this. Is it even possible to translate a regular sine curve into one that lingers at its extremes?

A function that is not even technically sinusoidal would be ok so long as it is periodic or can be made periodic by modulo-ing x.

1

There are 1 best solutions below

0
On

Try:

$$f(x) = \frac{\vert\sin x\vert^{2-p}}{\sin x}$$

If $p=0$, you have a regular sine curve: enter image description here When $p$ goes from $0$ to $1$, the function smoothly goes between the extremes. $p = \frac{1}{2}$: enter image description here Finally, as $p$ goes to $1$ you get the square wave. enter image description here The function can also be written as:

$$f(x) = \text{sgn}(\sin x)\cdot\vert\sin x\vert^{1-p}$$

This might give some more intuition as to why it works. For more, see Desmos.