Calculation of acceleration due to gravity