Lesson 12 of 15

Percolation Theory

Percolation Theory

Percolation theory studies how connectivity emerges in random systems. It has applications in epidemic spreading, oil recovery, and network resilience.

Site Percolation on a 1D Chain

In site percolation, each site on a lattice is independently occupied with probability pp. A cluster is a maximal connected group of occupied sites.

In 1D, sites are connected only to their immediate left and right neighbors.

Percolation Threshold

The percolation threshold pcp_c is the minimum pp at which an infinite cluster exists:

  • 1D chain: pc=1p_c = 1 — you must occupy all sites for the cluster to span the system
  • 2D square lattice: pc0.5927p_c \approx 0.5927
  • 3D cubic lattice: pc0.3116p_c \approx 0.3116

Key Quantities

Mean cluster size (average over all clusters): s=isinumber of clusters\langle s \rangle = \frac{\sum_i s_i}{\text{number of clusters}}

Percolation probability (fraction of sites in the largest cluster): P=smaxNP_{\infty} = \frac{s_{\max}}{N}

Near the threshold: P(ppc)βP_{\infty} \sim (p - p_c)^\beta with β=1\beta = 1 in 1D.

Random Number Generator

We use a Linear Congruential Generator (LCG): xn+1=(axn+c)modmx_{n+1} = (a \cdot x_n + c) \mod m with a=1664525a = 1664525, c=1013904223c = 1013904223, m=232m = 2^{32}. A site is occupied if xn+1/m<px_{n+1}/m < p.

Implementation

def generate_1d_lattice(N, p, seed=42):
    # LCG: a=1664525, c=1013904223, m=2**32
    # Each step: state=(a*state+c)%m; occupied if state/m < p
    ...

def find_clusters_1d(lattice):
    # Scan left to right, track contiguous runs of 1s
    # Return list of cluster sizes
    ...

def mean_cluster_size(cluster_sizes):
    # Return average cluster size
    ...

def percolation_probability(cluster_sizes, N):
    # Return max(cluster_sizes) / N
    ...
Python runtime loading...
Loading...
Click "Run" to execute your code.