Add acceleration calculation function.