<s>[INST] Evaluating $\int_{0}^{1} \int_{0}^{1} \int_{0}^{1} \sqrt{{x^2+y^2+z^2}}\, dx \,dy \,dz$ by converting to spherical coordinates 
I would like to know how to evaluate the following triple integral with the help of spherical coordinates
$$\int_{0}^{1} \int_{0}^{1} \int_{0}^{1} \sqrt{{x^2+y^2+z^2}} \,dx \,dy\, dz$$

The relations between Cartesian coordinates and spherical ones are given by
${\displaystyle {\begin{aligned}x&=r\,\sin \theta \,\cos \varphi \\y&=r\,\sin \theta \,\sin \varphi \\z&=r\,\cos \theta \end{aligned}}}$
I know that a function is generally integrated over $\mathbb{R}^3$ by the following triple integral
$$ \ \int \limits _{\varphi =0}^{2\pi }\ \int \limits _{\theta =0}^{\pi }\ \int \limits _{r=0}^{\infty }f(r,\theta ,\varphi )r^{2}\sin \theta \,\mathrm {d} r\,\mathrm {d} \theta \,\mathrm {d} \varphi .$$
I found a numerical solution with Wolfram Alpha (0.960592), I tried to change the bounds of integration from Cartesian to spherical but I got a different numerical value.
Could someone please give a detailed solution showing how to change the limits of integration?
Thanks.
 [/INST] Substitute:
$$z=\sqrt{x^2+y^2} t$$
$$I=\int_{0}^{1} \int_{0}^{1} \int_{0}^{1/\sqrt{x^2+y^2}} (x^2+y^2) \sqrt{{1+t^2}} dt dy dx$$
Integrating w.r.t. $t$:
$$I=\frac{1}{2} \int_{0}^{1} \int_{0}^{1}  (x^2+y^2) \left(\frac{1}{\sqrt{x^2+y^2}}\sqrt{1+\frac{1}{x^2+y^2}}+\sinh^{-1} \frac{1}{\sqrt{x^2+y^2}} \right) dy dx$$
Using the symmetry:
$$I= \int_{0}^{1} \int_{0}^{x}  (x^2+y^2) \left(\frac{1}{\sqrt{x^2+y^2}}\sqrt{1+\frac{1}{x^2+y^2}}+\sinh^{-1} \frac{1}{\sqrt{x^2+y^2}} \right) dy dx$$
Now we can use polar coordinates:
$$x=r \cos \phi$$
$$y=r \sin \phi$$
$$0<\sin \phi<\cos \phi, \qquad 0<\phi< \frac{\pi}{4}$$
$$0<r< \frac{1}{\cos \phi}$$
$$I= \int_{0}^{\frac{\pi}{4}} \int_{0}^{\frac{1}{\cos \phi}}  r^3 \left(\frac{1}{r}\sqrt{1+\frac{1}{r^2}}+\sinh^{-1} \frac{1}{r} \right) dr d \phi$$
$$I= \int_{0}^{\frac{\pi}{4}} \int_{0}^{\frac{1}{\cos \phi}}   \left(r\sqrt{r^2+1}+r^3 \sinh^{-1} \frac{1}{r} \right) dr d \phi$$
We have:
$$\int_{0}^{\frac{1}{\cos \phi}} r\sqrt{r^2+1} dr= \frac{1}{3} \left(\frac{1}{\cos^2 \phi}+1 \right)^{3/2}-\frac{1}{3}$$
$$\int_{0}^{\frac{1}{\cos \phi}} r^3 \sinh^{-1} \frac{1}{r} dr= \frac{1}{4 \cos^4 \phi}   \sinh^{-1} \cos \phi+ \frac{1-2 \cos^2 \phi}{12 \cos^3 \phi} \sqrt{1+\cos^2 \phi}+\frac16$$
So we have a complicated expression:
$$I= \frac{\pi}{24}+ \frac13 \int_{0}^{\frac{\pi}{4}} \left(\left(\frac{1}{\cos^2 \phi}+1 \right)^{3/2}-1 \right) d \phi+ \\+ \frac{1}{4} \int_{0}^{\frac{\pi}{4}} \left( \frac{1}{\cos \phi}\sinh^{-1} \cos \phi+ \frac{1}{3} (1-2 \cos^2 \phi)\sqrt{1+\cos^2 \phi} \right) \frac{d \phi}{\cos^3 \phi}$$
These are elliptic kind of integrals, though some of them might be elementary. Substitution $\cos \phi=s$ seems prudent here.
I hope this might be helpful.
Maybe using spherical coordinates from the start is better, but I haven't figured out the correct bounds yet either.
</s>