Evaluating an integral in mathematica What does this interal evaluate to $$\int_m^n\int_m^n\frac{1}{4\sqrt{u^2+v^2}}\ du\ dv?$$
Mathematica seems to crap out on this.
Assume $m,n>0$.
 A: Often you have to specify conditions on the constants to get Mathematica to give you an answer: else it gets all worried about them being imaginary and integrating over singularities and branch cuts and so on. Try again, putting Assuming[{m,n}>0, ] around it.
In this case, though, the integral is possible to do by hand. First let's do the $u$ integral. Setting $u=v\sinh{x}$ gives
$$ \int_n^m \frac{du}{\sqrt{u^2+v^2}} = \int_{\arg\sinh{(n/v)}}^{\arg\sinh{(m/v)}} \frac{v\cosh{x}}{\sqrt{v^2}\cosh{x}} \, dx, $$
and we immediately see a problem with whether we are allowing $v$ to be negative. The conditions allow us to take $v$ is positive, thankfully. The integrand for the $v$ has therefore become
$$ \arg\sinh{(m/v)}-\arg\sinh{(n/v)} = \log{(m+\sqrt{m^2+v^2})}-\log{(n+\sqrt{n^2+v^2})}, $$
since $v>0$. One can find by integrating by parts that
$$ \int \log{(m+\sqrt{m^2+v^2})} \, dv = v \log \left(m+\sqrt{m^2+v^2}\right)+m \log \left(v+\sqrt{m^2+v^2}\right)-v+C, $$
which gives
$$ m \log \left(m+\sqrt{2m^2}\right)+m \log \left(m+\sqrt{2m^2}\right)-n \log \left(m+\sqrt{m^2+n^2}\right)-m \log \left(n+\sqrt{m^2+n^2}\right) - m \log \left(n+\sqrt{n^2+m^2}\right)-n \log \left(m+\sqrt{n^2+m^2}\right) + n \log \left(n+\sqrt{2n^2}\right)+n \log \left(n+\sqrt{2n^2}\right), $$
which cancels down to
$$ 2 \left(n \log \left(\frac{n}{\sqrt{m^2+n^2}+m}\right)+m \log \left(\frac{m}{\sqrt{m^2+n^2}+n}\right)+(m+n)\log{(1+\sqrt{2})} \right), $$
and the integral you ask for has a half in front instead of a $2$ due to the factor of $4$.
(Oh, and yes, I have got $m$ and $n$ the wrong way round. Note it makes no difference to the final result.)
A: This is another approach which convert the two dimensional integral to a line integral first.
Let $r = \sqrt{u^2+v^2}$, $\displaystyle\;P = -\frac{v}{r}$ and $\displaystyle\;Q = \frac{u}{r}$, it is easy to check
$$\frac{\partial Q}{\partial v} - \frac{\partial P}{\partial u} = \frac{1}{r}$$
By Green's theorem, we have
$$\frac14 \int_{[m,n]^2} \frac{du dv}{r} 
= \frac14 \int_{\partial [m,n]^2} P du + Qdv 
= \frac14 \int_{\partial [m,n]^2} \frac{u dv - vdu}{\sqrt{u^2+v^2}}
$$
The boundary $\partial [m,n]^2$ consists of 4 line segments


*

*$v = m$, $u : m \to n$.


$$\verb/RHS/ = -\frac{m}{4} \int_m^n \frac{du}{\sqrt{u^2+m^2}} = -\frac{m}{4}\left[\sinh^{-1}\left(\frac{u}{m}\right)\right]_m^n
= -\frac{m}{4}\left(\sinh^{-1}\left(\frac{n}{m}\right) - \sinh^{-1}(1)\right)$$


*

*$u = n$, $v : m \to n$.


$$\verb/RHS/ = \frac{n}{4}\int_m^n \frac{dv}{\sqrt{n^2 + v^2}} =\frac{n}{4}\left[\sinh^{-1}\left(\frac{v}{n}\right)\right]_m^n = \frac{n}{4}\left(\sinh^{-1}(1) - \sinh^{-1}\left(\frac{m}{n}\right)\right)$$


*

*$v = n$, $u : n \to m$.
$$\verb/RHS/ = -\frac{n}{4}\int_n^m \frac{du}{\sqrt{u^2+n^2}}
= -\frac{n}{4}\left[\sinh^{-1}\left(\frac{u}{n}\right)\right]_n^m = \frac{n}{4}\left(\sinh^{-1}(1) - \sinh^{-1}\left(\frac{m}{n}\right)\right)$$

*$u = m$, $v : n \to m$.
$$\verb/RHS/ = \frac{m}{4}\int_n^m \frac{dv}{m^2 + v^2} =
\frac{m}{4}\left[\sinh^{-1}\left(\frac{v}{m}\right)\right]_n^m = -\frac{m}{4}\left(\sinh^{-1}\left(\frac{n}{m}\right)-\sinh^{-1}(1)\right)$$
Combine these four terms, we get
$$\frac14 \int_{[m,n]^2} \frac{du dv}{r}
= \frac{m+n}{2}\sinh^{-1}(1) - \frac{m}{2}\sinh^{-1}\left(\frac{n}{m}\right) - \frac{n}{2}\sinh^{-1}\left(\frac{m}{n}\right)\\
= \frac{m+n}{2}\log(\sqrt{2}+1)
 - \frac{m}{2}\log\left(\frac{\sqrt{n^2+m^2}+ n}{m}\right)
 - \frac{n}{2}\log\left(\frac{\sqrt{m^2+n^2}+ m}{n}\right)$$
