asdf1 said:
for a particle in a box,
why is U a constant=0 in the box but infinite on the outside?
also why when you are calculating the probability, the range is from negative infinity to positive infinity? and then why do you have to change it to go from 0 to L?
Pretty much what da_willem said- I'm just "wordier". First of all, potential is always "relative" to some base so you can always take the potential at some point to be 0. In this simple (non-realistic) example, the point is to look at a sharp jump in potential so it assumes a constant potential inside the box which can then be taken to be 0- actually any constant would give the same result.
With a finite "potential well"- that is if the potential were any finite value, as long as it was larger than the total energy of the particle, outside the box, you would find the particle has some probability of being outside the box- where, classically, it doesn't have enough energy to be! Taking the potential outside the box to be "infinite" (again, non-realistic) simplifies the calculations greatly giving discreet eigenvalues and forcing the particle to be within the box.
In general, to find the expected position of the particle, you would have to integrate the "probability" function over all space: x, y, z going from -infinity to infinity(you may be working in only one dimension but it's the same thing). If that probability function is 0 outside some area- in this case, outside the box, then, as da-willem said, that part of the integral will be 0 and can be ignored. I presume, though you didn't say it, that the box has one corner at (0,0,0) and sides of length L. Integrating from 0 to L covers all the region in which the probability function can be non-zero.