BOUNDS FOR GRADIENT TRAJECTORIES OF DEFINABLE FUNCTIONS WITH APPLICATIONS TO ROBOTICS AND SEMIALGEBRAIC GEOMETRY