Calculate position and velocity