Calculation of kinetic energy of a moving object