<s>[INST] Close-form for triple integral $ \int_0^c \int_0^b \int_0^a \sqrt{x^2+y^2+z^2} dx dy dz$ I am able to work out the double integral
$$\int_0^b \int_0^a \sqrt{x^2+y^2} dx dy $$
with brute-force (i.e. integrating $x$, then $y$) to arrive at the close-form result
$$\frac13ab\sqrt{a^2+b^2} +\frac16a^3\sinh^{-1}\frac ba +\frac16 b^3 \sinh^{-1}\frac ab$$
which has the expected parity between $a$ and $b$. However, it gets unwieldy to tackle the triple-integral extension $$\int_0^c \int_0^b \int_0^a \sqrt{x^2+y^2+z^2} dx dy dz$$
this way and I am unable to slug it out. Does anyone know the corresponding close-form expression for the triple version?
 [/INST] A start
Spherical coordinates. $(\rho,\theta,\phi)$.  They are related to rectangular coordinates $(x,y,z)$ by:
\begin{align}
x &= \rho\sin\theta\cos\phi\\
y &= \rho\sin\theta\sin\phi\\
z &= \rho\cos\theta
\end{align}
and in reverse by
\begin{align}
\rho &= \sqrt{x^2+y^2+z^2}\\
\theta &=\arccos\frac{z}{\sqrt{x^2+y^2+z^2}}\\
\phi &= \arctan\frac{y}{x}
\end{align}
The box we want is
$$
0 \le x \le a,\\
0 \le y \le b,\\
0 \le z \le c.
$$
In spherical coorcinates:
$$
0 \le \rho\sin\theta\cos\phi \le a,\\
0 \le \rho\sin\theta\sin\phi \le b,\\
0 \le \rho\cos\theta \le c.
$$
If we think we will express our integrals using $\rho$ a function of $\theta,\phi$, do this as
$$
0 \le \rho \le a\csc\theta\sec\phi,\\
0 \le \rho \le b\csc\theta\csc\phi,\\
0 \le \rho \le c\sec\phi
$$
Our triple integral will have three terms, depending on which of the three
$a\csc\theta\sec\phi,b\csc\theta\csc\phi,c\sec\phi$ is smallest.  That is,
dependingon which of the three faces the ray from the origin with angles $\theta,\phi$ intersects.
</s>