Hoshen–Kopelman cluster labeling →
Eight steps with Python and Julia notebooks, plus six independently compilable C checkpoints.
I first write a small part of a calculation and test it. Once I understand the result, I add the next part. These lessons follow that approach rather than beginning with a complete program and asking students to understand everything at once.
I first explain what I want to calculate and define the quantities. I write a small code cell or C program, then compare its result with a known answer. If the check fails, I examine that part before adding the next operation. Each lesson retains the complete program for comparison. The notebook cells follow this sequence, and each C checkpoint is a complete program.
Download the teaching collection ↓ · Read the completed checks →
The Python notebook collection includes the color portrait, all five portrait programs, full diffusion and random-walk examples, binary spinodal simulation, topology, full-resolution 3D algorithms and native VPython viewers. The pages show explained code cells and their measured outputs. The short lessons below provide a smaller starting point.
Eight steps with Python and Julia notebooks, plus six independently compilable C checkpoints.
Grid, initial profile, one Fourier propagation and an analytical check, in Python and Julia.
One molecular step, repeated sweeps and a mean-square-displacement check, in Python and Julia.
One conserved update, a separate elastic kernel and short matched evolutions, in Python and Julia.
Periodic neighbors, local energy change, acceptance and repeated trials, in Python and Julia.
Seven NumPy steps and a direct-sum reference check.
My NumPy code, from initial composition through a checked polynomial free energy and a coupled Fourier update on a 256 × 256 grid.
The following resources already develop their calculations through notebook cells. Their complete source and numerical work remain available.
The 256³ spinodal example, topology playground and NRCM C examples retain their simulations, explanations and complete sources. The short lessons above do not replace those models or their measured results.