Fractal Cosine
y = cos(x+t) + cos(3x+t)/2 + cos(9x+t)/4 + cos(27x+t)/8 + cos(81x+t)/16
Open in the app The dials and keys named below are the app's.
What it draws
Five cosines are added, each three times as fine and half as tall as the one before it. The wavenumbers are 1, 3, 9, 27, 81, so crests are 6.28, 2.09, 0.698, 0.233 and 0.0776 apart. The heights are 1, ½, ¼, ⅛ and 1/16.
The sum can never exceed their total, 1.9375, and it reaches it. At x = 0 every term is cos(t), so the origin swings through the full range with period 2π ≈ 6.28 seconds at Speed 1. Every wavenumber is odd, so at x = ±π every term is −cos(t): those points swing as far, in exact antiphase.
Why it is fractal
This is a partial sum of the Weierstrass function, Σ aⁿ·cos(bⁿx) with a = ½ and b = 3. Each term costs half the height and buys three times the detail, so the roughness never smooths out. Carried to infinity the function is continuous everywhere and differentiable nowhere, since a·b = 1.5 clears the threshold 1 that G. H. Hardy proved sufficient in 1916. Five terms is still a smooth curve, but the structure shows. Magnify it three times across and two up and the same picture returns, one term shorter: f(x) = cos(x + t) + ½·g(3x), where g is the same sum without its last term.
The clock is what makes it churn. Every term carries the same +t rather than its own, so a term of wavenumber k travels at 1/k. That is one unit per second for the first, then 0.333, 0.111, 0.037 and 0.0123. The fine ripples all but stand still while the coarse shape moves out from under them.
History
Weierstrass presented the function in Berlin on 18 July 1872, against the belief that a continuous function must have a derivative except at isolated points. His own proof needed b an odd integer and a·b above 1 + 3π/2 ≈ 5.71, which these values do not meet. Bolzano had built such a function around 1831, but it stayed unpublished until 1922.
Try
- Add a sixth term, + cos(243x + t)/32: crests 0.0259 apart, and the outline barely changes.
- Keep only cos(x + t) + cos(3x + t)/2 + cos(9x + t)/4: an ordinary wobbly wave, the roughness gone.
- Give each term its own clock: cos(x + t) + cos(3x + 3t)/2 + cos(9x + 9t)/4 + cos(27x + 27t)/8 + cos(81x + 81t)/16. Every term now travels at one unit per second, and the shape slides rigidly instead of boiling.
- Turn Span of x down to 1: the longest term flattens into a tilt and the fine detail becomes the shape.