Fractals and Hausdorff Dimension
Fractals and Hausdorff Dimension
Fractals are geometric objects that exhibit self-similarity at every scale. Unlike smooth curves (dimension 1) or filled surfaces (dimension 2), fractals can have non-integer dimensions — the Hausdorff dimension.
Box-Counting Dimension
The box-counting (Hausdorff) dimension is defined as:
where is the number of boxes of side length needed to cover the fractal.
Classic Fractal Dimensions
| Fractal | Dimension | Formula |
|---|---|---|
| Cantor Set | ≈ 0.6309 | |
| Koch Curve | ≈ 1.2619 | |
| Sierpiński Triangle | ≈ 1.5850 |
Cantor Set
Start with [0,1]. At each iteration, remove the middle third from every interval. After iterations: intervals of length remain. Self-similarity ratio , copies , so .
Koch Curve
Start with a line segment. Replace each segment with four segments of length . Self-similarity: copies at ratio , so .
Sierpiński Triangle
Start with a filled triangle. Remove the central triangle at each step, leaving 3 copies at half the scale. .
Box-Counting in Practice
Given a set of points, estimate by counting how many grid boxes of size contain at least one point. Plot vs ; the slope is .
Implementation
Implement the following functions:
import math
def hausdorff_dim_cantor():
# Return log(2)/log(3)
...
def hausdorff_dim_koch():
# Return log(4)/log(3)
...
def hausdorff_dim_sierpinski():
# Return log(3)/log(2)
...
def cantor_set_count(n_iterations):
# Return number of intervals after n iterations = 2^n
...
def box_count_estimate(points_x, epsilon):
# Count distinct grid boxes of size epsilon containing points
...