Lesson 10 of 15

Correlation Dimension

Correlation Dimension

The Grassberger-Procaccia correlation dimension (D₂) is a fractal dimension that can be estimated directly from a time series, making it invaluable for analyzing real-world chaotic systems.

The Correlation Sum

Given N points from an attractor, the correlation sum C(r) measures the fraction of point pairs within distance r:

C(r) = (2 / N(N-1)) · #{pairs (i,j) with |xᵢ - xⱼ| < r}

The Correlation Dimension

For a fractal set, C(r) scales as a power law:

C(r) ~ r^D₂

So:

D₂ = lim_{r→0} log C(r) / log r

We estimate D₂ as the slope of log C(r) vs log r.

Significance

Attractor TypeD₂
Fixed point0
Limit cycle1
2-torus2
Lorenz attractor≈ 2.06
Hénon attractor≈ 1.22

A non-integer D₂ is strong evidence for a strange attractor (chaos).

Your Task

Implement:

  1. correlation_sum(points, r) — compute C(r) for 1D points
  2. correlation_dimension(points, r_values) — estimate D₂ via linear regression on log-log plot
Python runtime loading...
Loading...
Click "Run" to execute your code.