Photon counting (Hanbury Brown-Twiss) and coherence (Mach-Zehnder): see why a laser, a lamp and a single-photon source look different.
Monte-Carlo coincidences vs the exact threshold-detector formula, and the coherence integrals vs closed forms.
The science
Photon energy. E = hc/λ, momentum p = h/λ; the mean photons per time bin are μ = P T / E.
Photon statistics. The second-order coherence at zero delay is g(2)(0) = 〈n(n-1)〉 / 〈n〉2. An ideal laser is a coherent state with Poisson counts, g2 = 1. Thermal light is bunched: with M = T/τc independent modes per bin the counts are negative-binomial and g2 = 1 + 1/M (2 when the bin is shorter than the coherence time). A single-photon (Fock) source can never produce two photons at once, g2 = 0 (antibunching). The Hanbury Brown-Twiss setup splits the beam 50:50, counts clicks at two threshold detectors and estimates g(2)(0) = NAB Nbins / (NA NB). The page plots the exact threshold-detector prediction, which approaches the ideal values when μη is small.
Coherence. For a Gaussian spectrum of width Δν = cΔλ/λ2 the fringe visibility of a Mach-Zehnder interferometer is V = |g(1)(τ)| = exp(-π2;Δν2τ2/(4 ln 2)) with τ = Δ/c, the coherence time is τc = ∫|g(1)|2dτ = 0.664/Δν and the coherence length ℓc = cτc. The fringe pattern is I = ½ I0 (1 + V cos φ).
Simplifications. A Gaussian line shape, ideal 50:50 splitters, no detector dead time or dark counts, thermal light treated as polarised single-mode statistics, and the single-photon source emits one photon with probability μ per bin. The beam picture is a cartoon, not a wave-packet simulation. Educational use only.