Volume of a cube in spherical polars Let us calculate the volume of the cube using spherical coordinates. The cube has side-length $a$, and we will centre it on the origin of the coordinates. Denote elevation angle by $\theta$, and the azimuthal angle by $\phi$.
Split the cube into 6 identical square based pyramids, by the planes $x = y, x = -y, x = z$ etc.
Take the square-based pyramid with the base on the plane $x = \frac{a}{2}$.
Then this pyramid is described by the following set of inequalities;
$\frac{\pi}{4} < \theta < \frac{3\pi}{4},
\;-\frac{\pi}{4} < \phi < \frac{\pi}{4},
\;0 < x < \frac{a}{2}$
Rewriting the last inequality in polar coordinates gives
$0 < r < \frac{a}{2 \cos(\phi)\sin(\theta)}$
and now we are in a position to write down the integral.
$V_\mathrm{cube} = 6 V_\mathrm{pyramid} = 6\iiint_\mathrm{pyramid} r^2 \sin(\theta) \mathrm{d}r \mathrm{d}\theta \mathrm{d}\phi$
Solve first the r integral, which gives 
$\int_0^\frac{a}{2 \cos(\phi)\sin(\theta)} r^2 dr = \frac{1}{24}\frac{a^3}{ \cos(\phi)^3\sin(\theta)^3}$ 
and so
$V_\mathrm{cube} = \frac{a^3}{4} \int_{-\frac{\pi}{4}}^\frac{\pi}{4} \frac{\mathrm{d}\phi}{\cos(\phi)^3} \int_{\frac{\pi}{4}}^\frac{3\pi}{4} \frac{\mathrm{d}\theta}{\sin(\theta)^2}   $
The antiderivative of $\sin^{-2} \theta$ is $-\cot \theta$, so the $\theta$ integral evaluates to 2, giving
$V_\mathrm{cube} = \frac{a^3}{2} \int_{-\frac{\pi}{4}}^\frac{\pi}{4} \frac{\mathrm{d}\phi}{\cos(\phi)^3}$
Mathematica tells me the remaining integral is not equal to 2, so I must've messed up somewhere. I can't see where though, can anyone else see what I've done wrong?
 A: The surfaces $\theta=\pi/4$ and $\theta=3\pi/4$ are cones, but your pyramid is bounded by planes that touch these cones, not by the cones.
A: As noted already, part of the boundary of your region of integration is
formed by the cones $\theta=\frac\pi4$ and $\theta=\frac{3\pi}4$
(curved surfaces),
whereas the boundary should be completely composed of planar polygons.
Your region of integration includes regions outside the desired pyramid.
The limits of $\theta$ are indeed $\frac\pi4 \leq \theta \leq \frac{3\pi}4$
when $\phi = 0$, but when $\phi = \pm\frac\pi4$ 
(on the edges of the pyramid's base parallel to the $z$ axis),
the correct limits are 
$\arctan\left(\sqrt2\right) \leq \theta \leq \pi - \arctan\left(\sqrt2\right)$.
More generally, consider the point $\left(\frac a2, y, \frac a2 \right)$
along the top edge of the pyramid's base.
The polar angle of that point is
$$\theta = \arctan\left( \frac{\sqrt{\left( \frac a2 \right)^2 + y^2}}
                    {\left( \frac a2 \right)} \right)
= \arctan\left( \sqrt{1 + \frac{4y^2}{a^2}}\right)
$$
The azimuthal angle at that point is 
$$\phi = \arctan\left(\frac{y}{\left( \frac a2 \right)} \right)
 = \arctan\left(\frac{2y}{a} \right)$$
which gives us $\frac{2y}{a} = \tan\phi$ and therefore
$\theta  = \arctan\left( \sqrt{1 + \tan^2 \phi}\right) = \arctan(\sec\phi).$
So if you want to give the integration of the pyramid another shot, 
try it with the limits
$\arctan(\sec\phi) \leq \theta \leq \pi - \arctan(\sec\phi).$
