So what is actually happening is you are doing a volume integral in cylinderical polars. Your source vector is the general cylinderical stuff for x'y'z' and then your field point (the point where you observe the potential) is at some distance z away from the center of the cylinder. Now this z is different to the z' you used to set up your source vector in cylinderical coordinates. In the potential equation and others too you always integrate over the source variables only. This is why in Griffiths book those source stuff has a ' next to it. Then your seperation vector will be r-r' and for the z component you will get z-z'. Here you set ip your integral and it goes from 0 to R for dr, 0 to 2pi for dphi and -L/2 to L/2 for dz' (remember we sre in cylinderical coordinates and this is a triple integral). Now in your integrand you will have a term (z-z')^2 in it and so you can do a change of variables say q=z-z' then you will need to change the integration limits from z'=-L/2 to L/2 to q=z+L/2 to z-L/2, this is because when z'=L/2 then q=z-L/2 and same for the other thing. But wait now you say your limits are flipped! Yip this is fine because in your integral you have dz' but we are no longer integrating over dz' but rather dq. So dq= - dz' snd when you sub that in and let your limits absorb the minus sign then you get z+L/2 in the top and z-L/2 in the bottom. I hope this helps. You will not understand this if you don't have a good understanding of multivariable calculus or if you don't work through it as you read this comment. Also if this mathematical explanation didn't work then there is anothwr one that I don't like as much but a cylinder is basically lots and lots of plane circles added up together. So this means we can find the potential from the center of a plane circle at a distance z away. Then in order to make this circle a cylinder then we need to 'sweep' over some length L. Setting out origin at the same place as 1 circle then you already have the potential at z away from this one circle. So you need to move the circle -L/2 to get the bottom bit of the cylinder. Now you have the potential due to z-L/2 of the cylinder. But bow you need to cover the top bit. So you have to add L to it as you move the circle from z-L/2 to z (this is at the origin point we defined) then to z+L/2. Now you have covered the whole cylinder and ao your limits are z-L/2 to z+L/2. Personally I like the maths one more and this limits is just a change of variables in my opinion. I woukd do the integral as -L/2 to L/2 but keep the z-z' in the integrand, it's not a big deal.
I don't understand the limit you take over z...please disclose it clearly
So what is actually happening is you are doing a volume integral in cylinderical polars. Your source vector is the general cylinderical stuff for x'y'z' and then your field point (the point where you observe the potential) is at some distance z away from the center of the cylinder. Now this z is different to the z' you used to set up your source vector in cylinderical coordinates. In the potential equation and others too you always integrate over the source variables only. This is why in Griffiths book those source stuff has a ' next to it. Then your seperation vector will be r-r' and for the z component you will get z-z'. Here you set ip your integral and it goes from 0 to R for dr, 0 to 2pi for dphi and -L/2 to L/2 for dz' (remember we sre in cylinderical coordinates and this is a triple integral). Now in your integrand you will have a term (z-z')^2 in it and so you can do a change of variables say q=z-z' then you will need to change the integration limits from z'=-L/2 to L/2 to q=z+L/2 to z-L/2, this is because when z'=L/2 then q=z-L/2 and same for the other thing. But wait now you say your limits are flipped! Yip this is fine because in your integral you have dz' but we are no longer integrating over dz' but rather dq. So dq= - dz' snd when you sub that in and let your limits absorb the minus sign then you get z+L/2 in the top and z-L/2 in the bottom.
I hope this helps. You will not understand this if you don't have a good understanding of multivariable calculus or if you don't work through it as you read this comment.
Also if this mathematical explanation didn't work then there is anothwr one that I don't like as much but a cylinder is basically lots and lots of plane circles added up together. So this means we can find the potential from the center of a plane circle at a distance z away. Then in order to make this circle a cylinder then we need to 'sweep' over some length L. Setting out origin at the same place as 1 circle then you already have the potential at z away from this one circle. So you need to move the circle -L/2 to get the bottom bit of the cylinder. Now you have the potential due to z-L/2 of the cylinder. But bow you need to cover the top bit. So you have to add L to it as you move the circle from z-L/2 to z (this is at the origin point we defined) then to z+L/2. Now you have covered the whole cylinder and ao your limits are z-L/2 to z+L/2.
Personally I like the maths one more and this limits is just a change of variables in my opinion. I woukd do the integral as -L/2 to L/2 but keep the z-z' in the integrand, it's not a big deal.