# Integrating $\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \frac{\log\left( x^2 + 2 x \sin(\theta) + 1 \right)}{x + 2 \sin(\theta)} d\theta$

Let $x>0$. I've encountered the following integral: $$I(x) \ = \ \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \frac{\log\left( x^2 + 2 x \sin(\theta) + 1 \right)}{x + 2 \sin(\theta)} d\theta$$

Is there a way to integrate this? I've been looking through Gradshteyn and Ryzhik, and I have found some similar integrals but nothing that looks exactly like this. Maybe through a contour integration?

If there is no way to integrate this, is it possible to derive asymptotics for the above $I(x)$ in the limit $x \to \infty$?

• Try $\displaystyle\mathrm{I}'\left(x\right)$. – Felix Marin May 7 '18 at 0:07
• Interesting suggestion, but I get the following mess which is even worse to deal with: $$I'(x) = \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \left[ \frac{2 x + 2 \sin(\theta)}{\left(x + 2 \sin(\theta) \right)\left( x^2 +2 x \sin(\theta) + 1 \right)} - \frac{\log\left( x^2 + 2 x \sin(\theta) + 1 \right)}{\left(x + 2 \sin(\theta)\right)^2}\right] d\theta$$ – Greg.Paul May 7 '18 at 4:20
• Surprising or not, a CAS is able to produce the antiderivative which is just .... a monster ! – Claude Leibovici May 7 '18 at 4:40
• @ClaudeLeibovici What is CAS ? – onurcanbektas May 7 '18 at 5:56
• @onurcanbektas. Computer Algebra System. Have a look at en.wikipedia.org/wiki/Computer_algebra_system – Claude Leibovici May 7 '18 at 6:08

## 3 Answers

As I wrote in a comment, a CAS was able to find the antiderivative (the resulting formula is a few pages long !).

The only thing I was able to do is to expand the integrand as a Taylor series built at $t=0$ and then to integrate between the given bounds. Using the expansion to $O(t^{5})$ the result is $$3840 x^5 \left(x^2+1\right)^4\,I(x)=2 \left(960 \pi x^4+80 \pi ^3 x^2-\pi ^5 \left(x^2-12\right)\right) \left(x^2+1\right)^4 \log \left(x^2+1\right)+\pi ^3 x^2 \left(\pi ^2 \left(3 x^8-42 x^6-97 x^4-82 x^2-24\right)-80 \left(3 x^2+2\right) \left(x^3+x\right)^2\right)$$

Using $x=10^k$ and the above formula, we can compare with the numerical integration. Below are some results for ten significant figures. $$\left( \begin{array}{ccc} k & \text{approximation} & \text{integration} & \color{blue} {\text{Maxim's asymptotics}}\\ 1 & 0.7285409898 & 0.7285572863 & \color{blue} {0.7284940770}\\ 2 & 0.1446859930 & 0.1446860624 & \color{blue} {0.1446860611}\\ 3 & 0.02170136876 & 0.02170136887 &\color{blue} { 0.02170136887}\\ 4 & 0.002893513786 & 0.002893513786 & \color{blue} {0.002893513786}\\ 5 & 0.0003616892206 & 0.0003616892206 & \color{blue} {0.0003616892206}\\ 6 & 0.00004340270647 & 0.00004340270647 & \color{blue} {0.00004340270647} \end{array} \right)$$ Using the result and expanding again as a Taylor series for infinitely large values of $x$ $$I(x)=\pi \frac {\log(x)} x+O\left(\frac{\log(x)}{x^3}\right)$$

Edit

For the evaluation fo the integral, it could be simpler to build a $[1,1]$ Padé approximant at $t=0$. This will give for the integrand $$\frac{a +b\, t}{1+c\, t}=\frac b c+\frac{a-\frac b c}{1+c\,t}$$ (easy to integrate) where $$a=\frac{\log \left(x^2+1\right)}{x}$$ $$b=\frac{\left(x^2+2\right) \log \left(x^2+1\right)-2 x^2}{\left(x^2+1\right) \left(\left(x^2+1\right) \log \left(x^2+1\right)-x^2\right)}$$ $$c=\frac{2 \left(x^2+1\right)^2 \log \left(x^2+1\right)-x^2 \left(3 x^2+2\right)}{x \left(x^2+1\right) \left(\left(x^2+1\right) \log \left(x^2+1\right)-x^2\right)}$$ This would give $$\left( \begin{array}{ccc} k & \text{approximation} & \text{integration} \\ 1 & 0.7290369069 & 0.7285572863 \\ 2 & 0.1446872219 & 0.1446860624 \\ 3 & 0.02170137072 & 0.02170136887 \\ 4 & 0.002893513788 & 0.002893513786 \\ 5 & 0.0003616892207 & 0.0003616892206 \\ 6 & 0.00004340270647 & 0.00004340270647 \end{array} \right)$$

Update

Concerning the initial Taylor expansion, the problem is a little simpler considering $$\frac{\log (a+2 b \sin (t))}{b+2 \sin (t)}=\sum_{n=0}^4 c_i \, t^i + O\left(t^5\right)$$ where $a=x^2+1$ and $b=x$. This leads to $$c_0=\frac{\log (a)}{b}\qquad c_1=\frac{2 \left(b^2-a \log (a)\right)}{a b^2}$$ $$c_2=\frac{4 a^2 \log (a)-2 b^2\left(2 a +b^2\right)}{a^2 b^3}$$ $$c_3=\frac{a^3 \left(b^2-24\right) \log (a)+24 a^2 b^2-(a-12) a b^4+8 b^6}{3 a^3 b^4}$$ $$c_4=\frac{-4 a^4 \left(b^2-12\right) \log (a)-48 a^3 b^2+4 (a-6) a^2 b^4+2 (a-8) a b^6-12 b^8}{3 a^4 b^5}$$ Now $$\int_{-\frac \pi 4}^{\frac \pi 4} \frac{\log (a+2 b \sin (t))}{b+2 \sin (t)}\,dt\approx\frac{\pi}{2} c_0+\frac{\pi ^3}{96} c_2+\frac{\pi ^5 }{2560}c_4$$ Going to asymptotics $$I(x)=\pi\frac{ \log (x)}{x}\left(1+\frac{\pi ^2 \left(80-\pi ^2\right)}{960\, x^2} +\cdots\right)$$

Update

After Maxim's answer, I added in blue the value obtained for the integral using jis/her asymptotics. Much better than mine.

• The remainder in the formula for $I(x)$ should be $O(x^{-3} \log x)$. – Maxim May 7 '18 at 18:14
• @Maxim. You are indeed very correct ! Thanks for pointing out. By the way, have you been able to do something with this integral ? Cheers. – Claude Leibovici May 8 '18 at 4:48
• I've added an answer. The coefficient at $x^{-3} \ln x$ should be $2 (\pi - 2)$. The problem is that when you expand the integrand to higher orders around $t = 0$, you'll get $x^{-3} \ln x$ contributions from higher order terms as well. – Maxim May 8 '18 at 14:39

If you make the standard substitution $\theta = 2 \arctan u$, the integrand becomes $$\frac {\ln \frac {P(u)} {Q(u)}} {R(u)},$$ where $P, Q, R$ are quadratic polynomials. Factoring the polynomials and formally expanding the logarithm reduces the indefinite integral to a sum of integrals of the form $$\int \frac {\ln u} {u + a} du = \ln u \ln \left( 1 + \frac u a \right) + \operatorname{Li}_2 \left( - \frac u a \right).$$ With the natural choice of the factors, the antiderivative will be continuous in $u$ for large positive $x$, yielding a closed form for the definite integral.

To obtain the asymptotic, you can simply expand the integrand around $x = \infty$ and integrate term by term: $$\frac {\ln (x^2 + 2 x \sin \theta + 1)} {x + 2 \sin \theta} = \\ \frac {2 \ln x} x - \frac {4 \ln x \sin t - 2 \sin t } {x^2} + \frac {8 \ln x \sin^2 t + \cos 2 t - 4 \sin^2 t} {x^3} + o(x^{-3}), \\ I(x) = \frac {\pi \ln x} x + \frac {2 (\pi - 2) \ln x - \pi + 3} {x^3} + o(x^{-3}).$$

• Thanks for posting this answer. You are totally right for the asymptotics; your approach is much better than mine. – Claude Leibovici May 8 '18 at 14:43
• What is intresting is that $2(\pi-2)\approx 2.28319$ while $\frac{\pi ^3 \left(80-\pi ^2\right)}{960}\approx 2.26509$ and that $\pi-3= 0.14159$. – Claude Leibovici May 8 '18 at 15:06
• Hoping that you don't mind, I added to my answer the value of the integral using the asymptotics you provided. Impressive ! – Claude Leibovici May 8 '18 at 15:20

For $x$ sufficiently large, and putting all in the form

$$2\int_{-\pi/4}^{\pi/4} \frac{\log(x)}{x}\cdot \frac{\textrm{d}\theta}{1+2\sin(\theta)/x}+\int_{-\pi/4}^{\pi/4} \frac{\log\left(1 + 1/x (2\sin(\theta) + 1/x) \right)}{x }\cdot \frac{\textrm{d}\theta}{1+2\sin(\theta)/x}$$ combined with the power series of $\log(1+x)$ and $\displaystyle \frac{1}{1+x}$, and integrating termwise, we arrive, for example, at the asymptotical behaviour

$$I(x)\approx\pi\frac{\log(x)}{x}+\frac{2(\pi-2)\log(x)+3-\pi}{x^3}+\frac{12(3\pi-8)\log(x)-21\pi+64}{6x^5}.$$

• Using this,we almost get the exact value of the integral. For $x=10$, we get $0.7285564014$ and for $x=100$, we get $0.1446860624$. – Claude Leibovici May 9 '18 at 3:12