I need to compute: $\displaystyle\int \int \int z dxdydz$
over the domain: $\left\{x^2+y^2+z^2\leqslant 16,z\geqslant 0\right\}$
Im trying to use spherical coords as:
\begin{equation} \int_{0}^{2\pi} \int_{0}^{\frac{\pi}{2}} \int_{0}^{4} r \cos(\theta )r^2\sin(\varphi ) \;dr\,d\theta \,d\varphi \end{equation}
It gives me $0$ as result. But i know that is wrong, the same formula computed with Mathematica software returns $64 \pi$.
{x, y, z} =
r {Cos[ϕ] Sin[θ], Sin[ϕ] Sin[θ], Cos[θ]};
Integrate[
z Abs[Det[D[{x, y, z}, {{r, θ, ϕ}}]]],
{r, 0, 4}, {θ, 0, π/2}, {ϕ, 0, 2 Pi}]
My procedure is:
$$\int_{0}^{2\pi} \int_{0}^{\frac{\pi}{2}} \int_{0}^{4} r \cos(\theta )r^2\sin(\varphi ) \;dr\,d\theta \,d\varphi=\int_{0}^{2\pi} \int_{0}^{\frac{\pi}{2}} \int_{0}^{4} r^3 \cos(\theta )\sin(\varphi ) \;dr\,d\theta \,d\varphi=$$ $$=\int_{0}^{2\pi} \int_{0}^{\frac{\pi}{2}}64 \cos(\theta ) \sin(\varphi ) d\theta d\varphi = \int_{0}^{2\pi} -64 \sin(\varphi ) d\varphi = 64 \cos(2\pi ) - 64 \cos(0)=0$$
EDIT: I see the name of the angles can be confusing, so this is mi current notation:
$x=r \sin(\theta ) \cos (\varphi )$
$y=r \sin(\theta ) \sin (\varphi )$
$z=r \cos(\theta)$
$\varphi$ should be the azimuthal angle, and $\theta$ the polar angle
The problem is in (1) where $\sin\varphi$ should be $\sin\theta$.
$$\int_{0}^{2\pi}\sin\theta d\varphi \int_{0}^{\frac{\pi}{2}}d\theta \int_{0}^{4}r^2dr (r \cos\theta ) $$
$$=\int_{0}^{2\pi} d\varphi \int_{0}^{\frac{\pi}{2}}\sin\theta \cos\theta d\theta \int_{0}^{4}r^3dr =2\pi*(1/2)* 64=64\pi$$