Calculation of work done in physics