Many geometric objects are well described by an integer dimension: a line is 1D, a plane region is 2D, and a solid volume is 3D.
Fractals challenge this picture because they can be “more than a line but less than a filled region.” A practical way to quantify
this is the box-counting dimension. The idea is simple: cover the set with a grid of square boxes of side length
\(\varepsilon\) and count how many boxes touch the set. Call this number \(N(\varepsilon)\). As you make the boxes smaller, the count
typically grows, often following a power law:
\[
N(\varepsilon) \sim C\,\varepsilon^{-D}.
\]
Taking logs gives a linear relationship:
\[
\log N(\varepsilon) \approx D\,\log(1/\varepsilon) + \log C,
\]
so the slope of the line in a log–log plot estimates \(D\).
This calculator uses that method for two classic examples. The Sierpinski triangle is constructed by repeatedly
subdividing a triangle into four congruent sub-triangles and removing the central one. After many iterations, the remaining set has
no area but still spreads across the plane in a highly structured way. Its exact (theoretical) dimension is
\[
D=\frac{\log 3}{\log 2}\approx 1.585,
\]
because each stage creates 3 self-similar copies scaled by a factor of \(1/2\). With a finite pixel grid, box counting will only
approximate this value; increasing resolution and using several box sizes usually improves stability.
The Mandelbrot set comes from iterating \(z_{n+1}=z_n^2+c\) in the complex plane. Points \(c\) whose orbits stay
bounded form the set. The boundary is extremely intricate: zooming in reveals new detail at every scale. In box counting, it is often
better to measure boundary pixels rather than the filled interior. If you count the interior, large portions behave like a 2D region
and can push the estimate toward \(D\approx 2\). Boundary-focused counting tends to reflect the fractal edge more directly.
Box counting is also tied to the “coastline paradox”: the measured length of a coastline depends on the size of the
ruler you use. Smaller rulers capture more wiggles, increasing the measured length. Similarly, smaller boxes capture more detail,
increasing \(N(\varepsilon)\). A stable slope over a range of box sizes indicates scale-consistent behavior. In real computations,
estimates can be distorted by too few scales, too coarse a grid, or pixel/aliasing effects. That’s why this tool shows the full
\(N(\varepsilon)\) table and the log–log plot: you can judge whether the data points align well enough for the fitted slope to be
trusted.