Your second problem is happening because of the way you set up the integral. By putting the bounds of the integral from x2 to x1, you have already ensured that the motion of the particle is to the left (-x direction). You can either specify the direction using the sign of dr and running the...