Partition Counting at 2 AM
Published:
Partition Counting at 2 AM
Half past two in the morning, third coffee going cold, and I am staring at the SOFI pipeline wondering why the 6th-order cumulant image looks subtly wrong. The moment-to-cumulant conversion is not just a formula you plug in – it requires summing over all partitions of a set, weighted by Mobius function values on the partition lattice. Let me walk through the orders, because the escalation in complexity is the whole story.
At 2nd order, life is simple. You subtract the squared mean from the second moment and you are done:
κ₂ = ⟨I²⟩ − ⟨I⟩² = ⟨δI(t) · δI(t+τ)⟩
At 4th order things get busier. The point of higher-order cumulants is that they subtract out the Gaussian contributions – everything that could be explained by a normal distribution gets removed, leaving only the “interesting” fluctuation structure. The 4th-order expression has five terms:
κ₄ = ⟨I⁴⟩ − 4⟨I³⟩⟨I⟩ − 3⟨I²⟩² + 12⟨I²⟩⟨I⟩² − 6⟨I⟩⁴
But 6th order is the worst. Three distinct partition types contribute – pair-quartet, triple-triple, and triple-pair configurations – each with its own combinatorial prefactor. The expression expands to:
κ₆ = Σ_pair-quartet [ (−1)^(k−1) (k−1)! · μ₂μ₄ ]
+ Σ_triple-triple [ (−1)^(k−1) (k−1)! · μ₃² ]
+ Σ_triple-pair [ (−1)^(k−1) (k−1)! · μ₂³ ]
The symptom was subtle – PSF narrowing looked geometrically correct following the expected √n rule, but relative intensities between bright and dim emitters were wrong by about 15%. That kind of error does not scream “bug”; it whispers “maybe the sample is just uneven.” After stepping through the partition enumeration by hand on paper, I found that the triple-pair partition count was being divided by 3 instead of multiplied by 3 in the symmetry correction step. One character in the code, hours of confusion.
√6 ≈ 2.45x resolution improvement. Structures at roughly 90 nm become resolvable from a conventional widefield setup with a 220 nm diffraction limit. Worth the partition headache. Repository here.
