sin(x)+x "stairs" curve, but which starts from the "flat" part

586 Views Asked by At

I'm not a math person, but I use math curves in my animation work with Blender.

I would need this sin(x)+x "stairs" curve, but it should begin from the red dot being in the origin.

Ideally the "stairs" should be the height of 1.0 per each and the width of 1.0 from each other, but this is not required if it makes things too complicated.

How the formula should be edited in order to get that desired result?

BONUS, extra appreciation if some other methods are provided to make the vertical part of the "stairs", or the lines pointing upwards, to grow and shrink more exponentially than now. Like this.

enter image description here

4

There are 4 best solutions below

2
On BEST ANSWER

Found a perfect answer to what I was looking for with the help of this - Result:

https://www.desmos.com/calculator/azirgqxnuw

enter image description here

1
On

To get the red dot on the $y$-axis (where $x=0$) instead of at $x=\pi$, shift the variable $x$ by $-\pi$ to get $$\sin(x-(-\pi))+(x-(-\pi))=\sin(x+\pi)+(x+\pi).$$ To get the red dot on the $x$-axis (where $y=0)$ instead of at $y=\pi$, shift the whole function by $-\pi$ to get $$\sin(x+\pi)+(x+\pi)-\pi=\sin(x+\pi)+x.$$ To get steps of width $1$ instead of width $2\pi$, scale the variable $x$ by a factor $2\pi$ to get $$\sin\left(2\pi x+\pi\right)+2\pi x.$$ To get the steps of height $1$ instead of $2\pi$, scale the whole function down by a factor $2\pi$ to get $$\frac{\sin\left(2\pi x+\pi\right)+2\pi x}{2\pi}=\frac{1}{2\pi}\sin(2\pi x+\pi)+x.$$

4
On

Are you maybe looking for shifting the offset? Maybe something like

$$ \sin(x + \pi) + x $$

is good enough?

1
On

Input the below into desmos

$$x\ -\frac{1}{2}\ +\ \frac{1}{\pi}\sum_{n=1}^{a}\frac{\sin\left(2\pi nx\right)}{n}\ \left\{x\ge0\right\}$$

When prompted, add a slider for $a$. The larger your $a$ the better the stairs will look. You can change the $0$ in the curly brackets at the end to shift the stairs as you wish.

In case you wish to know more about where this expression came from, you can check out the following links:

Floor Function

Fourier Series

Fourier Series for the Floor function