Gaussian Blur
y = ∫₋₂² sign(sin(3(x − u) − t)) · exp(−4u²) du
Open in the app The dials and keys named below are the app's.
What it draws
Inside the integral, sign(sin(3·(x − u) − t)) is a square wave, +1 or −1 and nothing between, with wavenumber 3 and so a wavelength of 2π/3 ≈ 2.09, shifted along by u. The other factor, e^(−4u²), is a bell with standard deviation 1/√8 ≈ 0.354. Integrating their product over u replaces the square wave at each x by its average under the bell centred there. That is a convolution, and a convolution with a bell is a Gaussian blur, the same operation an image editor applies to soften a picture. The limits ±2 cut the bell where it is already e^(−16) ≈ 10⁻⁷ high, so they cost nothing.
The blur takes the corners off and the height down. Without it the square wave weighed by the bell would stand at ∫e^(−4u²) du = √π/2 ≈ 0.886; the blurred crests reach about 0.65, just under three quarters of that, and the flat tops are gone. The −t inside the sine carries the whole pattern to the right, a crest advancing a third of a unit each second at Speed 1, so one wavelength passes in 2π ≈ 6.28 seconds.
Why the corners go
A square wave is a sum of odd harmonics, (4/π)·(sin v + sin 3v/3 + sin 5v/5 + …), with v = 3·(x − u) − t here. So the harmonics have wavenumbers 3, 9, 15 and up. Blurring with a Gaussian multiplies each harmonic by a factor of its own, e^(−w²/16) for wavenumber w, because the transform of a bell is another bell. The fundamental keeps e^(−9/16) ≈ 0.57 of its height. The third harmonic keeps e^(−81/16), under 1%, and the rest are gone. What survives is very nearly the fundamental alone, (4/π)·0.886·0.57 ≈ 0.64 high, which is why the blurred square wave looks like a sine. The sharp edges were the high harmonics; the blur is a low-pass filter, and they are what it removes.
Try
- Blur a single edge instead, integral(sign(x − u)·exp(−4u²), u, −2, 2): the step becomes a smooth ramp, the error function, climbing from −0.886 to 0.886 and already at 0.75 half a unit from the edge.
- Slow the wave down, integral(sign(sin((x − u) − t))·exp(−4u²), u, −2, 2): with a wavelength of 2π ≈ 6.28 the same bell only rounds the corners, and the flat top at 0.886 shows. The crests now travel a unit a second.
- Widen the bell, integral(sign(sin(3·(x − u) − t))·exp(−u²), u, −2, 2): the standard deviation doubles to 0.707, the fundamental keeps only e^(−9/4) ≈ 0.11 of its height, and the wave all but vanishes.
- Drop the blur, 0.886·sign(sin(3x − t)): the square wave the integral started from, at the height the bell's weight gives it, with the vertical edges the blur removed.