This implementation of trans_vel_in should be changed to use time_derivative with pos_vector_in at each step. The current one will give a wrong output in the general case.