Calculation of Heat and Work