Use Matrix instead of array functions to compute the new velocity.