📉 Weierstrass Nowhere-Differentiable Function

The Weierstrass function W(x) = Σ aⁿ·cos(bⁿπx) is continuous everywhere but differentiable nowhere when ab > 1 + 3π/2. Zoom to see fractal self-similarity at every scale.

MathematicsInteractive
Scroll to zoom · Click+drag to pan · R reset · adjust a, b, N

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.

W(x) = Σₙ₀⁰ aⁿ · cos(bⁿπx)
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⁻⁶.

About this simulation

This plotter sums N terms of the series W(x) = Σ aⁿ·cos(bⁿπx) and lets you zoom and pan into the resulting curve to see it never smooths out. Because amplitude a < 1 shrinks each term while frequency b > 1 grows it, the graph packs infinitely fine wiggles into every interval — a live illustration of a function that is continuous everywhere yet differentiable nowhere.

🔬 What it shows

A truncated Weierstrass sum plotted across a zoomable x-range, with live-computed Hausdorff dimension D = 2 + log(a)/log(b) and Hölder exponent α = log(1/a)/log(b) shown alongside the ab product that determines differentiability.

🎮 How to use

Adjust Parameter a and Parameter b to change the amplitude decay and frequency growth, set Terms N for approximation precision, then scroll or use the Zoom level slider and click-drag (or Center x) to explore self-similarity at finer scales. Color mode can isolate individual cosine terms. R resets the view.

💡 Did you know?

When Karl Weierstrass presented this function in 1872, mathematician Charles Hermite reportedly called such pathological constructions "a dreadful plague" — yet it forced the field to abandon the assumption that continuity implies differentiability almost everywhere.

Frequently asked questions

Why does zooming in never make the curve look smooth?

Because the function is self-similar: scaling x by b and y by 1/a reproduces the same jagged structure at any scale. No matter how far you zoom with the Zoom level slider, new fine-scale oscillations from the higher-frequency terms keep appearing.

What happens if I set ab below 1?

The Diff.? stat switches to "Everywhere" — when ab < 1 the series' derivative term-by-term also converges, so the function becomes differentiable. Weierstrass's original pathological behavior requires ab ≥ 1 (informally ab > 1 + 3π/2 in his stricter original proof).

Why does increasing Terms N change the curve's fine detail but not its overall shape?

Each added term contributes a smaller-amplitude, higher-frequency wiggle (aⁿ and bⁿ respectively), so raising N refines detail at ever-finer scales without shifting the large-scale shape, which is already dominated by the first few terms.

What does the Hausdorff dimension D tell you about the graph?

D = 2 + log(a)/log(b) measures how "rough" the curve is — for a smooth curve D=1, but the Weierstrass function's graph has D strictly between 1 and 2 (e.g. ≈1.37 for a=0.5, b=3), quantifying its fractal, space-filling jaggedness.

Why use Per-term color mode instead of just the full sum?

Per-term mode draws the first five cosine components separately in distinct colors, letting you see how each individual frequency contributes before they're all added together — it visually decomposes the sum into the building blocks that create the nowhere-differentiable behavior.