how to calculate magnitude of velocity