Thermodynamic relation with partition function.