1

I need to evaluate $$ \int_0^{2\pi} \! d\theta \, \log\left(\sqrt{r^2 + s^2 -2rs\cos(\theta)} \right) $$ i.e. the log of the length of the third side of a triangle ($r$ and $s$ being the lengths of the first two sides), integrated over angle.

This is a bit reminiscent of some kind of elliptic integral, but I've never seen one with a log as its argument (I don't know much about elliptic integrals though).

Mathematica gives me the answer $$ -\pi \log\left(\frac{2}{r^2 + s^2 + |r^2 - s^2|}\right) $$ with conditions $r\neq0$ or $s\neq0$.

I would like to to find this analytically if I can for a number of reasons, e.g.

  • Mathematica weirdly doesn't give me this answer 100% of the time,
  • if I ask for the indefinite integral I get a massive expression in the complex numbers (which I've asked about over on Mathematica stack exchange: https://mathematica.stackexchange.com/questions/270314/integrate-ignoring-assumptions) so I want to understand how it reduces to such a simple expression,
  • I next need to integrate this against some functions of $r$ and $s$, so the more insight into the $\theta$ integral I have the better.

I'm not sure where to start tackling this analytically though. Can anyone point me in the right direction?

Quanto
  • 97,352
jms547
  • 179

3 Answers3

3

For $r\ge s$ \begin{align} I=&\int_0^{2\pi} \log\left(\sqrt{r^2 + s^2 -2rs\cos\theta} \right)d\theta\\ =& \int_0^{\pi} \log\left(r^2 + s^2 -2rs\cos\theta \right)d\theta\\ =& \int_0^{\pi} 2\log r+ \log\bigg(1-\frac {2s}r\cos\theta + \frac{s^2}{r^2}\bigg)d\theta =2\pi\log r \end{align} where $\int_0^{\pi} \log\left(1-\frac {2s}r\cos\theta + \frac{s^2}{r^2}\right)d\theta=0$. Similarly, $I=2\pi \log s$ for $s\ge r$.

Quanto
  • 97,352
  • Thanks this all looks legit, but I can't see where to get the factor of $-\pi\log(2)$, which is included in the answer that Mathematica spat out (and is obtained in my comment to Claude Leibovici's answer above. – jms547 Jul 05 '22 at 22:35
  • 1
    @jms547 - Note that the Mathematica result $ -\pi \log\left(\frac{2}{r^2 + s^2 + |r^2 - s^2|}\right)$ is equal to $2\pi \log r$ for $r\ge s$, and $2\pi \log s$ for $r\le s$. So, the two answers are the same. – Quanto Jul 06 '22 at 00:14
3

$$I=\int_0^{2\pi} \log\left(\sqrt{r^2 + s^2 -2rs\cos(\theta)} \right)\, d\theta=\frac 12 \int_0^{2\pi} \log\left({r^2 + s^2 -2rs\cos(\theta)} \right)\, d\theta$$ $$\log\left({r^2 + s^2 -2rs\cos(\theta)} \right)=\log(r^2+s^2)+\log \left(1-\frac{2 r s }{r^2+s^2}\cos (\theta )\right)$$ Let $a=\frac{2 r s }{r^2+s^2}$ and, as @Laxmi Narayan Bhandari commented, consider $$I(a)=\int_0^{2\pi} \log(1-a \cos (\theta ))\, d\theta$$ $$I'(a)=-\int_0^{2\pi}\frac{\cos (\theta )}{ (1-a \cos (\theta ))}\, d\theta=\frac{2 \pi }{a}\left(1-\frac{1}{\sqrt{1-a^2}}\right)$$ $$ I(a)=2 \pi \log \left(1+\sqrt{1-a^2}\right)$$

Combining all the above $$I=\frac 12\Bigg[2\pi\log(r^2+s^2)+2 \pi \log \left(1+\sqrt{1-\frac{4 r^2 s^2}{\left(r^2+s^2\right)^2}}\right)\Bigg]$$ Simplifying $$I=\pi \log \left( \left(r^2+s^2\right)+\sqrt{\left(r^2-s^2\right)^2}\right)=\pi\log \left( \left(r^2+s^2\right)+\left|r^2-s^2\right|\right)$$

  • Thanks for the answer! To complete the calculation we need the constant of integration to go from $I'(a)$ to $I(a)$. The easy thing to do is to try $a=0$, which gives $I(0)=\int_0^{2\pi} \log(1) d\theta = 0$. This makes the integration constant $-2\pi\log(2)$, which recovers the answer that Mathematica spat out. – jms547 Jul 06 '22 at 08:25
1

In my post, I found that $$ \int_{0}^{\pi} \ln (b \cos x+c) d x=\pi \ln \left(\frac{c+\sqrt{c^{2}-b^{2}}}{2}\right) $$ where $\left|\frac{b}{c}\right| \leqslant 1$ and $c \neq 0$. $$ \begin{aligned} I&=\int_{0}^{\pi} \ln \left[-2 r \sin \theta+r^{2}+s^{2}\right] d \theta\\ &=\pi \ln \left(\frac{r^{2}+s^{2}+\sqrt{\left(r^{2}+s^{2}\right)^{2}-(-2 r s)^{2}}}{2}\right.\\ &=\pi \ln \left(\frac{r^{2}+s^{2}+\left|r^{2}-s^{2}\right|}{2}\right)\\ &=2 \pi \ln (\max (r, s)) \end{aligned} $$

Lai
  • 20,421