computing velocity