I was attempting to generate 1D perlin noise, and I stumbled across a stackoverflow post that mentioned this function as a function that is never periodic.
$$\sin(2 x) + \sin(\pi x)$$
Is it actually non-periodic, or does it repeat?
I was attempting to generate 1D perlin noise, and I stumbled across a stackoverflow post that mentioned this function as a function that is never periodic.
$$\sin(2 x) + \sin(\pi x)$$
Is it actually non-periodic, or does it repeat?
The general question about periodicity of the sum of two periodic functions with non-commensurate periods is tricky as explained here. Among other things the construction there gives an example of functions $f$ with period $\pi$ and $g$ of period $2$, such that the sum $f+g$ has period $\sqrt2$.
However, here we can take advantage of the derivatives of sine waves.
Assume that the sum $f(x)=\sin 2x+\sin\pi x$ is periodic with period $L$. Then the same holds for the second derivative $$ f''(x)=-4\sin 2x-\pi^2\sin\pi x. $$ It follows that the linear combination $$ g_1(x):=4f(x)+f''(x)=(4-\pi^2)\sin\pi x $$ also has period $L$. But it is known that the fundamental period of $g_1(x)$ is $2$, so we can conclude that we must have $L=2m$ for some integer $m$.
By similarly looking at $$ g_2(x)=\pi^2f(x)+f''(x)=(\pi^2-4)\sin 2x $$ we see that $L$ must also be an integer multiple of $\pi$. At this point we arrive at a contradiction with the fact that $\pi/2$ is irrational.
Can this function $\sin 2 x + \sin \pi x$ take value (close to) $2$? We would need
\begin{array} 2x &= (\simeq) \frac{\pi}{2} + 2 k \pi \\ \pi x &= (\simeq) \frac{\pi}{2} + 2 l \pi \end{array}
that is $$\pi = (\simeq) \frac{4l+1}{4k+1}$$
While the equality is not possible ($\pi$ irrational). the approximate equality certainly is. Therefore the function has supremum $2$, but never achieves it. Now a continuous and periodic function achieves its supremum, so this function, being continuous, is not periodic.