Thermodynamic calculations. I: Using free-energy functions and heat-content functions