3

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?

Blue
  • 83,939

2 Answers2

6

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.

Jyrki Lahtonen
  • 140,891
  • A natural follow up question would be whether continuity already allows us to conclude. – Jyrki Lahtonen Mar 26 '25 at 13:42
  • It might be interesting to plot $f(t) = sin(2t)+sin(\pi t)$ as $x$ versus its derivative $f'(t)$ as $y$. It should result in a continuous crurve that never repeats. – M. Wind Mar 26 '25 at 21:51
  • May be @M.Wind? That didn't look very illuminating to me, but may be you see something else in it. Now that you brought it up, I just tried plotting the Lissajoux curves $(\sin 7t, \sin 11 t)$ as well as $(\sin 2t, \sin \pi t)$. The latter gradually drifts away from the former as $22/7$ is just a good approximation of $\pi$. The sharp curve of the periodic case gradually becomes a wider band... – Jyrki Lahtonen Mar 26 '25 at 23:30
1

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.

orangeskid
  • 56,630