In the statistical physics of spin glasses and other systems with quenched disorder, the replica trick is a mathematical technique based on the application of the formula: ln ⁡ ⁡ Z = lim n → → 0 Z n − − 1 n or: ln ⁡ ⁡ Z = lim n → → 0 ∂ ∂ Z n ∂ ∂ n where Z is most commonly the partition function, or a similar thermodynamic function.