pub fn partition_function(energies: &[f64], temp: f64, kb: f64) -> f64
Canonical partition function Z = Σ exp(−E_i / (k_B T)).