# Why does the sum of positive integer sine waves resemble a tangent?

I created the following on Desmos recently:
$$y=\displaystyle\sum_{n=1}^{50}\sin\left(nx\right)$$

While looking at it I noticed that it looks similar to $$tan(x)$$, so I tried to approximate it: $$\sin\left(0.5\right)\left(\tan\left(-0.25x\right)\right)$$

My question is why these numbers, and how can I be more accurate when plotting patterns in graphs?

• It in fact resembles $\;\cot x\;$ ... – DonAntonio Nov 18 '19 at 9:49
• I found it to be very similar to $0.5\cot\left(0.25x\right)$. Do you have any idea as to why? Thanks – user726468 Nov 18 '19 at 9:53

$$\sum_{k=1}^{50}\sin kx=\frac{\sin\left(\frac{51}2x\right)}{\sin\frac x2}\cdot\sin(25x)$$
But $$\;\sin a\sin b=\cfrac12\left(\cos(a-b)-\cos(a+b)\right)\;$$, so the sum above is in fact
$$\frac{\cos\frac x2-\cos\left(\frac{101}2x\right)}{2\sin\frac x2}$$