How it Works
The Weierstrass function is computed by summing N terms of the series W(x) = Σₙ₀⁰ aⁿ·cos(bⁿπx). Each term contributes a cosine wave with frequency bⁿ and amplitude aⁿ. Since a < 1, amplitudes decrease geometrically; since b > 1, frequencies increase geometrically. The balance between these rates determines the fractal properties.
For each pixel column x, the series is evaluated by summing all N terms. The y-value is mapped to the canvas coordinate with adaptive scaling. The zoom controls multiply the x-range by b̄zoomExp, revealing the same structure at finer scales — a visual demonstration of self-similarity.
Conditions: 0 < a < 1, b ∈ ℕ odd, ab > 1 + 3π/2
Hausdorff dim: D = 2 + log(a)/log(b)
Hölder exp: α = -log(a)/log(b) = log(1/a)/log(b)
The zoom slider uses powers of b as the zoom factor, so each unit of zoom reveals one more level of the recursive structure. This directly demonstrates the mathematical self-similarity: scaling x by b and y by 1/a produces the same function shape, confirming that W(bx)/a = W(x) - cos(πx) (modulo a simple correction term).
Frequently Asked Questions
What is the Weierstrass function?
The Weierstrass function W(x) = Σ aⁿ·cos(bⁿπx) is a classic example of a function continuous everywhere but differentiable nowhere. Published by Karl Weierstrass in 1872, it shattered 19th-century intuition that continuous implied piecewise differentiable.
When is the Weierstrass function nowhere differentiable?
The function is nowhere differentiable when 0 < a < 1, b is a positive odd integer, and ab > 1 + 3π/2 (Weierstrass's original condition). Hardy later proved it suffices to have a < 1 and ab ≥ 1. Typical choices: a=0.5, b=3 or a=0.7, b=10.
Why is the Weierstrass function continuous everywhere?
The series Σ aⁿ·cos(bⁿπx) converges uniformly because |aⁿ·cos(...)| ≤ aⁿ and Σ aⁿ converges (geometric series with |a| < 1). A uniform limit of continuous functions is continuous, so W(x) is continuous everywhere.
What is the fractal dimension of the Weierstrass function?
The graph has Hausdorff dimension D = 2 + log(a)/log(b). For a=0.5 and b=3: D ≈ 2 - 0.631 = 1.369. This fractional dimension reflects the jagged, self-similar structure of the graph.
What is Hölder continuity?
A function f is Hölder continuous with exponent α if |f(x)-f(y)| ≤ C|x-y|α. The Weierstrass function is Hölder continuous with exponent α = log(1/a)/log(b), strictly less than 1, meaning it is not Lipschitz but is uniformly continuous.
What mathematical intuition did the Weierstrass function overturn?
Before 1872, many mathematicians believed every continuous function must be differentiable except at isolated points. Charles Hermite called such functions 'a dreadful plague'. The Weierstrass function proved this completely wrong and opened real analysis and fractal geometry.
How does zooming reveal self-similarity?
Because W(x) = a·W(bx)/a + cos(πx), zooming by factor b horizontally while stretching vertically by 1/a reveals the same structure. The function looks the same at every scale (modulo a simple transformation) — the mathematical definition of self-similarity.
Are there other nowhere-differentiable continuous functions?
Yes. The Takagi-Landsberg function T(x) = Σ (1/2)ⁿ·s(2ⁿx) (where s is the sawtooth wave) is another example. Brownian motion is almost surely nowhere differentiable. Banach proved in 1931 that 'most' continuous functions (Baire category) are nowhere differentiable.
What role did the Weierstrass function play in fractal geometry?
The Weierstrass function is considered a precursor to fractal geometry. Its non-integer Hausdorff dimension, self-similarity, and pathological differentiability anticipate formal fractal concepts developed by Mandelbrot and others in the 1970s–1980s.
Can computers draw the true Weierstrass function?
Computers can only approximate it by truncating to finitely many terms. For screen resolution, 20–50 terms suffice — more terms contribute oscillations too fine to display at pixel resolution. The approximation converges geometrically: 20 terms give accuracy better than a²⁰ ≈ 10⁻⁶.