Moriarty's calculator: some bizarre and deceptive graphical anomalies

Don't actually know how exactly Nyquist-Shannon theorem is related to this, but here's a crackdown of what happens with $\sin\left(77\frac{\pi}{158}n\right)$ for $n=1..158$ (equivalently, $\sin(77x)$ with $x=\frac{\pi n}{158}$):

$$f(n)=\sin\left(77\frac{\pi}{158}n\right)=\sin\left(\left(\frac{79}{158}\pi-\frac{2\pi}{158}\right)n\right)=\\ =\sin\left(\left(\frac\pi2-\frac\pi{79}\right)n\right)=\sin\frac{\pi n}2\cos\frac{\pi n}{79}+\cos\frac{\pi n}2\sin\frac{\pi n}{79}.$$

Now consider 4 cases:

  1. $n=1+4k,\,k\in\mathbb Z$, then $f(n)=\cos\frac{\pi n}{79}$
  2. $n=2+4k,\,k\in\mathbb Z$, then $f(n)=-\sin\frac{\pi n}{79}$
  3. $n=3+4k,\,k\in\mathbb Z$, then $f(n)=-\cos\frac{\pi n}{79}$
  4. $n=0+4k,\,k\in\mathbb Z$, then $f(n)=\sin\frac{\pi n}{79}$

This is exactly what you asked about $\pm\sin(2x)$ and $\pm\cos(2x)$ functions inside samples of $\sin(77x)$, where $x=\frac{\pi n}{158}$.