A nice example of setting up integrals in spherical coordinates:
Set up the triple integral of a function f over the volume shown in figure 1 to the right. The top back corner (the green point) is (0,5/2,5 sqrt(3)/2), and the bottom front corner (the red point) is (5/4,5 sqrt(3)/4,-5 sqrt(3)/2). The volume itself is a section of a sphere.
To set up the integral, let's think of slices with theta fixed. This gives slices similar to that suggested in figure 2, which shows a plane with constant theta along the front of the volume. Then to figure out the range of phi and rho, we're thinking of a slice that looks like those shown in figures 3 and 4. Figure 3 is the slice along the back of the volume, and figure 4 is that of a slice along the front of the volume. In either case, we can see that rho is between 0 and
Then, what is the range for phi? The minimum value of phi is found by looking at figure 3, which shows the slice along the back face. Considering the orange triangle, we can see that the two perpendicular sides of the triangle have length 5/2 (for the horizontal side) and 5 sqrt(3)/2 (for the vertical side). The hypotenuse is 5. So, using the two sides that don't involve a square root the angle is arcsin(1/2) = pi/6.
Simlarly, considering figure 4 we can find the largest possible value of phi. The vertical side of the orange triangle has length 5 sqrt(3)/2. The hypotenuse is still 5, so the angle between the z-axis and the edge of the volume is arccos(sqrt(3)/2) = pi/6. The angle phi from the positive z-axis down is pi - pi/6 = 5 pi/6.
Whew! How are we doing? So far we've figured out the dimensions of the slices of the object when theta is fixed:
So, finally, what are the possible values of theta? We can see from the volume that the largest possible value is pi/2. We can see the total range by looking straight down on the volume, as shown in figure 5, which is the projection into the xy-plane. In this we can still see the green and red points on the corners. Using the red point, we can get the angle theta up from the x-axis: the (x,y) coordinates of the point are (5/4,5 sqrt(3)/4), so the angle theta is theta = arctan(sqrt(3)) = pi/3.
So we now have all three limits:
This results in the triple integral
(How were the figures here generated? In Maple, with this maple worksheet.)