# Is there a continuous waveform that sounds the same as a square wave?

The fourier series

$$f(t)=\sum_{n\in\mathbb N\\n\text{ odd}}\frac1n\,\sin(nt)$$

converges to a square wave. Square waves are discontinuous functions. I'm wondering if there's a continuous function that "sounds the same as" a square wave, in the sense that it has components with the same amplitude and frequency as the series above, but with different phases.

Do there exist $$a_n\in\mathbb R$$ such that

$$\sum_{n\in\mathbb N\\n\text{ odd}}\frac1n\,\sin(nt+a_n)$$

converges (pointwise everywhere) to a continuous function?

• I have no idea of the answer to the question in the body, but the question in the title is rather different, as it involves "sounds like". Because the human auditory system has a frequency roll-off ("we can't hear above 20kHz"), your first sum, truncated at, say, 50 kHz, will be continuous, but will "sound" just like a square wave. – John Hughes Dec 11 '18 at 13:06
• I think it's an established convention to use the word "sound" in mathematics to refer to the entire spectrum, for example in the classic problem of hearing the shape of a drum. – Oscar Cunningham Dec 11 '18 at 13:19
• Understood...but because I'm also interested in areas related to mathematics, I found the "common person's" interpretation of the question intriguing as well. – John Hughes Dec 11 '18 at 13:41
• The last example on J.D. Tillman's page "Square Wave Variations" suggests that the answer is yes. – Rahul Dec 11 '18 at 14:01
• I don't either. By the way, after some numerical experimentation I found another interesting function: Choose $a_n=c\sqrt n$ for some $c$, e.g. $c=2\pi$. I don't know for sure if that's continuous either, but it looks like it might be. – Rahul Dec 11 '18 at 18:13

If we have complete freedom in picking the phase shifts $$a_n$$, the answer is clearly affirmative: for some sequence $$S=\{a_n\}_{n\geq 0}$$, $$f_S(x) = \sum_{n\geq 0}\frac{\sin((2n+1)x+a_n)}{(2n+1)}$$ is a continuous function (proof postponed). On the other hand such continuous function is differentiable at almost no point, due to the rate of decay of the coefficients of its Fourier series, so it is a sort of Weierstrass function. And such wave does not sound as the square wave: any discontinuous signal (or even differentiable, but with large values attained by its derivative) is perceived as painful by our ear, due to the rapid changes of pressure on the eardrum (try the samples of the square wave and sawtooth wave on Wikipedia. As a folklore note, I believe the sample of the triangle wave was used in the intro of Mogwai's song sine wave).

By just considering the constant sequences, $$f_S(x)$$ ranges between the rectangle wave and the real part of $$\text{arctanh}(e^{ix})$$, i.e. $$\log\left|\tan(x/2)\right|$$: both functions are continous over $$\mathbb{R}\setminus \pi\mathbb{Z}$$, the former is bounded, the latter is not. In general

$$(\mathcal{L} f_S)(s) = \sum_{n\geq 0}\frac{(2n+1)\cos(a_n)+s \sin(a_n)}{(2n+1)((2n+1)^2+s^2)}$$ so if we pick $$a_n=n^2$$ we may exploit the fact that $$e^{in^2}$$ is sufficiently randomly distributed on the unit circle. By Weyl's inequality both $$\sum_{n=0}^{N}\sin(n^2)$$ and $$\sum_{n=0}^{N}\cos(n^2)$$ are $$\ll \sqrt{N}\log^2 N$$, hence by applying summation by parts in the series defining $$\mathcal{L} f_S$$, then $$\mathcal{L}^{-1}$$, we find that $$f_{\{n^2\}}(x)$$ is continuous.

Here it is an approximated depiction of such Weierstrass-like function:

Not a rectangle wave at all.

• "then $\mathcal{L}^{-1}$, we find that $f_{\{n^2\}}(x)$ is continuous." I got lost at this step. Am I missing some famous theorem that says that $f$ is continuous when $\mathcal Lf$ has some property? – Oscar Cunningham Dec 12 '18 at 0:10
• @OscarCunningham: the Laplace transform allows to discuss the continuity of trigonometric series since $$\lim_{x\to 0^+}f(x)=\lim_{s\to +\infty}s\cdot(\mathcal{L}f)(s).$$ For instance we may recognize the discontinuity of the sawtooth wave $f(x)=\sum_{n\geq 1}\frac{\sin(n x)}{n}$ from the fact that $f(0)=0$ but $\lim_{x\to 0^+} f(x)$, found through $\mathcal{L}$, equals $\frac{\pi}{2}$. – Jack D'Aurizio Dec 12 '18 at 0:38
• I got curious about human sensitivity to phase differences, so I looked up some research. There are some good references at the bottom of the Wikipedia article on phase distortion. Laitinen et al. (ResearchGate) did some listening tests with a sawtooth wave vs. its random-phase variant and reported interesting qualitative differences: the sawtooth is perceived to have 'a strong low pitch and “buzzy” quality' absent in the random-phase signal. – Rahul Dec 14 '18 at 8:10