# Evaluate $\int_{0}^{\frac{\pi}2}\frac1{(1+x^2)(1+\tan x)}\:\mathrm dx$

Evaluate the following integral $$\tag1\int_{0}^{\frac{\pi}{2}}\frac1{(1+x^2)(1+\tan x)}\,\mathrm dx$$

My Attempt:

Letting $$x=\frac{\pi}{2}-x$$ and using the property that

$$\int_{0}^{a}f(x)\,\mathrm dx = \int_{0}^{a}f(a-x)\,\mathrm dx$$

we obtain

$$\tag2\int_{0}^{\frac{\pi}{2}}\frac{\tan x}{\left(1+\left(\frac{\pi}{2}-x\right)^2\right)(1+\tan x)}\,\mathrm dx$$

Now, add equation $$(1)$$ and $$(2)$$. After that I do not understand how I can proceed further.

• I don't think there is a closed solution. The numerical value is $\approx 0.597382$. – Hans Engler Apr 17 '13 at 15:47
• Where did you get this from? – Aryabhata Apr 17 '13 at 15:53
• I don't have a closed form but I'm able to represent the integral as a series: $$\frac{\arctan(\frac{\pi}{2}) - t\log\sqrt{1+\frac{\pi^2}{4}}}{1+t^2} + \frac{\pi^2}{4} \sum_{n=0}^{\infty}\frac{ (2n+1)\left(\log(n+\frac{3}{4})-\log(n+\frac{1}{4})\right) }{ \left(1+\pi^2(n+\frac{1}{4})^2\right)\left(1+\pi^2(n+\frac{3}{4})^2\right) }$$ where $t = \tanh(1)$. I hope someone can simplify this further. BTW, summing the first $10^4$ term gives me 0.59738180945178, a number consistent with what Jacob got. – achille hui Oct 21 '13 at 5:07
• Seems the key to a lot of upvotes is to ask an impossible question! :) – Bennett Gardiner Nov 3 '13 at 23:58
• This is so far the weirdest question/tread I have encountered here at M.SE: all the answers are downvoted, and the most downvoted got the bounty!!! – Matemáticos Chibchas Apr 10 '14 at 22:48

Here is an approach.

We give some preliminary results.

## The poly-Hurwitz zeta function

The poly-Hurwitz zeta function may initially be defined by the series \begin{align} \displaystyle \zeta(s\mid a,b) := \sum_{n=1}^{+\infty} \frac{1}{(n+a)^{s}(n+b)}, \quad \Re a >-1, \, \Re b >-1, \, \Re s>0. \tag1 \end{align} This special function is a natural extension of the Hurwitz zeta function initially defined as $$\zeta(s,a)=\sum_{n=0}^{\infty} \frac{1}{(n+a)^s}, \quad \Re a>0, \Re s>1, \tag2$$ which is a natural extension itself of the Riemann zeta function initially defined as $$\zeta(s)=\sum_{n=1}^{\infty} \frac{1}{n^s}, \quad \Re s>1. \tag3$$

The poly-Hurwitz function appears in different places with different notations, one may find it here: [Masri, p. 2 and p. 15 (2004)], [Murty, p. 17 (2006)], [Sinha, p. 45 (2002)]. In this answer we are dealing with a simplified version of a general poly-Hurwitz function.

The series in $(1)$ converges absolutely for $\displaystyle \Re s>0$. Moreover, the convergence of the series is uniform on every half-plane $$\displaystyle H_{\delta}=\left\{s \in \mathbb{C}, \Re s \geq \delta \right\}, \, \delta \in \mathbb{R},\, \delta>0,$$ therefore the poly-Hurwitz zeta function $\displaystyle \zeta(\cdot \mid a,b)$ is analytic on the half-plane $\displaystyle \Re s>0$.

Let $a$, $b$ and $s$ be complex numbers such that $\Re a >-1, \, \Re b >-1, \, \Re s >0$. One may observe that \begin{align} \zeta(s\mid a,b) & = \sum_{n=1}^{+\infty} \frac{1}{(n+a)^{s}(n+b)}\\ & = \sum_{n=1}^{+\infty} \frac{(n+b)+(a-b)}{(n+a)^{s+1}(n+b)}\\ & = \sum_{n=1}^{+\infty} \frac{1}{(n+a)^{s+1}}+(a-b)\sum_{n=1}^{+\infty} \frac{1}{(n+a)^{s+1}(n+b)} \tag4 \end{align} giving the functional identity \begin{align} \zeta(s \mid a,b) = \zeta(s+1,a+1) +(a-b) \zeta(s+1 \mid a,b) \tag5 \end{align}

where $\displaystyle \zeta(\cdot,\cdot)$ is the standard Hurwitz zeta function.

From $(5)$, we obtain by induction, for $n=1,2,3,\ldots$,

\begin{align} \zeta(s\mid a,b) = \sum_{k=1}^{n}(a-b)^{k-1}\zeta(s+k,a+1) +(a-b)^n\zeta(s+n \mid a,b). \tag6 \end{align}

We use $(6)$ to extend $\displaystyle \zeta(\cdot \mid a,b)$ to a meromorphic function on each open set $\Re s>-n$, $n\geq 1$. Since the Hurwitz zeta function is analytic on the whole complex plane except for a simple pole at $1$ with residue $1$, then from $(6)$ the poly-Hurwitz zeta function $\displaystyle \zeta(\cdot\mid a,b)$ is analytic on the whole complex plane except for a simple pole at $0$ with residue $1$.

## The poly-Stieltjes constants

In 1885 Stieltjes has found that the Laurent series expansion around $1$ of the Riemann zeta function $$\zeta(1+s) = \frac{1}{s} + \sum_{k=0}^{\infty} \frac{(-1)^{k}}{k!}\gamma_k s^k, \quad s \neq 0,\tag7$$ is such that the coefficients of the regular part of the expansion are given by \begin{align} \gamma_k& = \lim_{N\to \infty}\left(\sum_{n=1}^N \frac{\log^k n}{n}-\frac{\log^{k+1} \!N}{k+1}\right). \end{align} \tag8 Euler was the first to define a constant of this form (1734) \begin{align} \gamma & = \lim_{N\to\infty}\left(1+\frac12+\frac13+\cdots+\frac1N-\log N\right)=0.577215\ldots. \end{align} The constants $\displaystyle \gamma_k$ are called the Stieltjes constants and due to the fact that $\displaystyle \gamma_0=\gamma$ they are sometimes called the generalized Euler's constants.

Similarly, Wilton (1927) and Berndt (1972) established that the Laurent series expansion in the neighbourhood of $1$ of the Hurwitz zeta function \begin{align} \zeta(1+s,a) = \frac1s+\sum_{k=0}^{\infty}\frac{(-1)^{k}}{k!} \gamma_{k}(a)\:s^{k}, \quad \Re a>0, \,s\neq 0, \tag{9} \end{align} is such that the coefficients of the regular part of the expansion are given by \begin{align} \gamma_k(a)& = \lim_{N\to \infty}\left(\sum_{n=0}^N \frac{\log^k (n+a)}{n+a}-\frac{\log^{k+1} (N+a)}{k+1}\right), \quad \Re a>0, \end{align} \tag{10} with $\displaystyle \gamma_{0}(a)=-\psi(a)=-\Gamma'(a)/\Gamma(a)$. The coefficients $\gamma_k(a)$ are called the generalized Stieltjes constants.

We have seen from $(6)$ that the poly-Hurwitz zeta function admits a Laurent series expansion around $0$. Let's denote by $\displaystyle\gamma_k(a,b)$ the coefficients of the regular part of $\displaystyle \zeta(\cdot\mid a,b)$ around $0$. I will call these coefficients the poly-Stieltjes constants.

Do we have an analog of $(10)$ for $\displaystyle\gamma_k(a,b)$?

The following result is new.

Theorem 1. Let $a,b$ be complex numbers such that $\Re a >-1, \, \Re b >-1$. Consider The poly-Hurwitz zeta function \begin{align} \zeta(s\mid a,b) := \sum_{n=1}^{+\infty} \frac{1}{(n+a)^{s}(n+b)}, \quad \Re s>0. \tag{11} \end{align} Then the meromorphic extension of $\displaystyle \zeta(\cdot\mid a,b)$ admits the following Laurent series expansion around $0$, $$\zeta(s \mid a,b) = \frac{1}{s} + \sum_{k=0}^{+\infty} \frac{(-1)^{k}}{k!}\gamma_k(a,b) s^k, \quad s \neq 0,\tag{12}$$ where the poly-Stieltjes constants $\displaystyle \gamma_k(a,b)$ are given by \begin{align} \gamma_k(a,b)& = \lim_{N\to+\infty}\left(\sum_{n=1}^N \frac{\log^k (n+a)}{n+b}-\frac{\log^{k+1} \!N}{k+1}\right) \end{align} \tag{13} with $$\gamma_{0}(a,b)=-\psi(b+1)=-\Gamma'(b+1)/\Gamma(b+1). \tag{14}$$

Proof. Let $a,b$ be complex numbers such that $\Re a >-1, \, \Re b >-1$.

We first assume $\Re s>0$. Observing that, for each $n \geq 1$, $$\left|\sum_{k=0}^{\infty}\frac{\log^k(n+a)}{n+b}\frac{(-1)^{k}}{k!}s^k\right| \leq \sum_{k=0}^{\infty}\left|\frac{\log^k(n+a)}{n+b}\right|\frac{|s|^k }{k!}<\infty$$ and that $$\sum_{n=1}^{\infty}\left|\sum_{k=0}^{\infty}\frac{\log^k(n+a)}{n+b}\frac{(-1)^{k}}{k!}s^k\right|=\sum_{n=1}^{\infty}\left|\frac1{(n+a)^s(n+b)}\right| = \sum_{n=1}^{\infty}\frac1{|n+a|^{\Re s}|n+b|}<\infty,$$ we obtain \begin{align} &\sum_{k=0}^{\infty}\frac{(-1)^{k}}{k!}\lim_{N\to+\infty}\left(\sum_{n=1}^N\frac{\log^k(n+a)}{n+b}-\frac{\log^{k+1} \!N}{k+1}\right) s^k \\\\ &= \lim_{N\to+\infty}\sum_{k=0}^{\infty} \frac{(-1)^{k}}{k!}\left(\sum_{n=1}^N\frac{\log^k(n+a)}{n+b}-\frac{\log^{k+1} \!N}{k+1}\right) s^k \\\\ &=\lim_{N\to+\infty}\sum_{k=0}^{\infty}\left(\sum_{n=1}^N\frac{(-1)^{k}}{k!}\frac{\log^k(n+a)}{n+b}s^k -\frac{(-1)^{k}}{k!}\frac{\log^{k+1} \!N}{k+1}s^k\right) \\\\ &=\lim_{N\to+\infty}\left(\sum_{n=1}^N\sum_{k=0}^{\infty}\frac{(-1)^{k}}{k!}\frac{\log^k(n+a)}{n+b}s^k -\sum_{k=0}^{\infty}\frac{(-1)^{k}}{k!}\frac{\log^{k+1} \!N}{k+1}s^k\right) \\\\ &=\lim_{N\to+\infty}\left(\sum_{n=1}^N\frac1{(n+a)^s(n+b)} +\frac1{N^s}-\frac1s\right) \\\\ &=\zeta(s \mid a,b)-\frac1{s} \end{align} as desired. Then, using $(6)$, we extend the preceding identity by analytic continuation to all $s \neq 0$. To prove $(14)$, we start from a standard series representation of the digamma function (see Abram. & Steg. p. 258 6.3.16): \begin{align} -\psi(b+1) &= \gamma - \sum_{n=1}^{\infty} \left( \frac1n - \frac1{b+n} \right) \\ &=\lim_{N\to+\infty}\left(\gamma - \sum_{n=1}^N\left( \frac1n - \frac1{b+n} \right)\right)\\ &=\lim_{N\to+\infty}\left(\left(\sum_{n=1}^N\frac1{b+n} -\ln N\right)-\left(\sum_{n=1}^N\frac1n-\ln N-\gamma \right)\right)\\ &=\lim_{N\to+\infty}\left(\sum_{n=1}^N\frac1{b+n} -\ln N\right)\\\\ &=\gamma_0(a,b) \end{align} using $(13)$.

$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Box$

One of the consequences of Theorem 1 is the new possibility to express some series in terms of the poly-Stieltjes constants.

Theorem 2. Let $a,b,c$ be complex numbers such that $\Re a >-1, \, \Re b >-1, \, \Re c >-1$.

Then \begin{align} (b-a)\sum_{n=1}^{+\infty} \frac{\log (n+c)}{(n+a)(n+b)}=\gamma_1(c,a)-\gamma_1(c,b), \tag{15} \end{align} similarly \begin{align} \sum_{n=1}^{+\infty} \frac1{n+b}\left({\log (n+a)-\log (n+c)}\right)=\gamma_1(a,b)-\gamma_1(c,b), \tag{16} \end{align} with the poly-Stieltjes constant $$\gamma_1(a,b) = \lim_{N\to+\infty}\left(\sum_{n=1}^N \frac{\log (n+a)}{n+b}-\frac{\log^2 \!N}2\right).$$

Proof. Let $a,b,c$ be complex numbers such that $\Re a >-1, \, \Re b >-1, \, \Re c >-1$.

We have $$(b-a)\frac{\log (n+c)}{(n+a)(n+b)}=\frac{\log (n+c)}{n+a}-\frac{\log (n+c)}{n+b}$$ giving, for $N\geq1$, \begin{align} (b-a)&\sum_{n=1}^N \frac{\log (n+c)}{(n+a)(n+b)}=\\\\ & \left(\sum_{n=1}^N\frac{\log (n+c)}{n+a}-\frac{\log^2 \!N}2\right)-\left(\sum_{n=1}^N\frac{\log (n+c)}{n+b}-\frac{\log^2 \!N}2\right) \tag{17} \end{align} letting $N \to \infty$ and using $(13)$ gives $(15)$.

We have, for $N\geq1$, \begin{align} &\sum_{n=1}^N \frac1{n+b}\left({\log (n+a)-\log (n+c)}\right)\\\\ &= \left(\sum_{n=1}^N\frac{\log (n+a)}{n+b}-\frac{\log^2 \!N}2\right)-\left(\sum_{n=1}^N\frac{\log (n+c)}{n+b}-\frac{\log^2 \!N}2\right) \tag{18} \end{align} letting $N \to \infty$ and using $(13)$ gives $(16)$.

$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Box$

## Juantheron's integral

Let’s first give a numerical evaluation of Juantheron’s integral.

I would like to thank Jonathan Borwein and David H. Bailey who obtained the result below to $1000$ digits, in just 3.9 seconds run time, using David's new MPFUN-MPFR software, along with the tanh-sinh quadrature program included with the MPFUN-MPFR package.

They also tried the integral with David's MPFUN-Fort package, which has a completely different underlying multiprecision system, and they obtained the same result below.

Finally, they computed the integral with Mathematica $11.0$; it agreed with the result below, although it required about 10 times longer to run.

Proposition 1. We have \begin{align} \int_{0}^{\Large\frac{\pi}2}\!&\frac1{(1+x^2)(1+\tan x)}\mathrm dx\\\\= 0.&59738180945180348461311323509087376430643859042555\\ &67307703207161550311033249824121789098990404474443\\ &73300942847961727020952797366230453350097928752529\\ &62099371263365268445580755896768905606293308536674\\ &89639352215352393870280616186538538722285601087082\\ &81730013060929540132583577240799018025603130403772\\ &83596189879605956759516344861849456740112012597646\\ &30195536341071109827787231788650530475635336662512\\ &50757672078320586388500276160658476344052492489409\\ &64026178233152015087197531148322444147655936720008 \tag{19}\\ &40650450631581050321100329502169853063154902765446\\ &58804861176982696627707544105655815406116180984371\\ &54148587721902800400109013880620460529382772599713\\ &06874977209651994186527207589425408866256042399213\\ &80515694164361264997143539392018681691584285790381\\ &65536517701019826846772718498479534803417547866296\\ &23842162877309354675086691711521468623807334908897\\ &71491673168051054009130049879837629516862688171756\\ &13790927986073268994254629238035029442300668334396\\ &901581838911515359223628586133156893962372426055\cdots \end{align}

David H. Bailey confirmed that Mathematica $11.0$, in spite of the great numerical precision, could not find a closed-form of the integral.

The next result proves that the OP integral admits a closed form in terms of the poly-Stieltjes constants.

Proposition 2. We have \begin{align} \int_{0}^{\Large\frac{\pi}2}\!\!\frac1{(1+x^2)(1+\tan x)}\mathrm dx &=\frac{(e^2+1)^2}{2(e^4+1)}\arctan \! \frac{\pi}{2}-\frac{e^4-1}{4(e^4+1)}\log\left(1+\frac{\pi^2}{4}\right)\\\\ &+\frac{64 \pi^2\log 3}{(\pi^2+16)(9\pi^2+16)} \\\\ &+\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac34,\frac34 +\frac{i}{\pi}\!\right) -\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac14,\frac34 +\frac{i}{\pi}\!\right)\tag{20}\\\\ &+\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac34,\frac14 -\frac{i}{\pi}\!\right) -\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac14,\frac14 -\frac{i}{\pi}\!\right) \end{align} with the poly-Stieltjes constant $$\gamma_1(a,b) = \lim_{N\to+\infty}\left(\sum_{n=1}^N \frac{\log (n+a)}{n+b}-\frac{\log^2 \!N}2\right).$$

Proof. We proceed in three steps.

Step 1. One may write \require{cancel} \begin{align} &\int_{0}^{\Large\frac{\pi}{2}}\frac{1}{(1+x^2)(1+\tan x)}\mathrm dx \\ &=\int_{0}^{\Large\frac{\pi}{2}}\frac{\cos x}{(1+x^2)(\cos x+\sin x)}\mathrm dx\\ &=\frac12\int_{0}^{\Large\frac{\pi}{2}}\frac{(\cos x+\sin x)+(\cos x-\sin x)}{(1+x^2)(\cos x+\sin x)}\mathrm dx\\ &=\frac12\int_{0}^{\Large\frac{\pi}{2}}\!\frac{1}{1+x^2}\mathrm dx+\frac12\int_{0}^{\Large\frac{\pi}{2}}\frac{1}{(1+x^2)}\frac{(\cos x-\sin x)}{(\cos x+\sin x)}\mathrm dx\\ &=\frac12 \arctan\! \frac{\pi}{2}+\frac12\int_{0}^{\Large\frac{\pi}{2}}\frac{1}{1+x^2}\tan (x-\pi/4)\:\mathrm dx\\ &=\frac12 \arctan\! \frac{\pi}{2}+\frac12\int_{-\Large\frac{\pi}{4}}^{\Large\frac{\pi}4}\frac{1}{1+(x+\pi/4)^2}\tan x \:\mathrm dx\\ &=\frac12 \arctan\! \frac{\pi}{2}+\frac12\int_0^{\Large\frac{\pi}4}\left(\frac1{1+(x+\pi/4)^2}-\frac1{1+(x-\pi/4)^2}\right)\tan x \:\mathrm dx\\ &=\frac12 \arctan\! \frac{\pi}{2}-\frac{\Im}2 \!\int_{0}^{\Large\frac{\pi}{4}}\!\!\left(\!\frac1{x+\pi/4+i}+\frac1{x-\pi/4-i}\!\right) \tan x \:\mathrm dx \tag{21} \end{align} Let’s evaluate the latter integral.

Step 2. One may recall that the tangent function, as a meromorphic function, can be expressed as an infinite sum of rational functions: $$\tan x = \sum_{n=0}^{+\infty} \frac{2x}{\pi^2 (n+1/2)^2-x^2}, \quad x \neq \pm \pi/2, \pm 3\pi/2,\pm 5\pi/2,\ldots. \tag{22}$$ We have the inequality $$\sup_{x \in [0,\pi/4]}\left|\frac{2x}{\pi^2 (n+1/2)^2-x^2}\right|\leq \frac1{(n+1/2)^2}, \quad n=0,1,2,\ldots, \tag{23}$$ the convergence in $(22)$ is then uniform on $[0,\pi/4]$. Thus, plugging $(22)$ into $(21)$, we are allowed to integrate $(21)$ termwise.

Each term, via a partial fraction decomposition, is evaluated to obtain \begin{align} \int_{0}^{\Large\frac{\pi}4}\!&\left(\!\frac1{x+\pi/4+i}+\frac1{x-\pi/4-i}\!\right)\frac{2x}{\pi^2 (n+1/2)^2-x^2}\:\mathrm dx\\ &=\frac{2\tau}{\pi^2 (n+1/2)^2-\tau^2}\log \left( \frac{4\tau-\pi}{4\tau+\pi}\right)\\ &+\frac1{\pi}\frac1{(n+1/2+\tau/\pi)}\left(\log\!\left(n+\frac34\right)-\log\!\left(n+\frac14\right) \right)\\ &+\frac1{\pi}\frac1{(n+1/2-\tau/\pi)}\left(\log\!\left(n+\frac34\right)-\log\!\left(n+\frac14\right) \right) \end{align} \tag{24} where for the sake of convenience we have set $\tau:=\pi/4+i$.

Step 3. We sum $(24)$ from $n=0$ to $\infty$ obtaining

\begin{align} \int_{0}^{\Large\frac{\pi}{4}}\!&\left(\!\frac1{x+\pi/4+i}+\frac1{x-\pi/4-i}\!\right) \tan x \:\mathrm dx\\ &=\sum_{n=0}^{\infty}\frac{2\tau}{\pi^2 (n+1/2)^2-\tau^2}\log \left( \frac{4\tau-\pi}{4\tau+\pi}\right)\\ &+\frac1{\pi}\sum_{n=0}^{\infty}\frac1{(n+1/2+\tau/\pi)}\left(\log\!\left(n+\frac34\right)-\log\!\left(n+\frac14\right) \right)\\ &+\frac1{\pi}\sum_{n=0}^{\infty}\frac1{(n+1/2-\tau/\pi)}\left(\log\!\left(n+\frac34\right)-\log\!\left(n+\frac14\right) \right), \tag{25} \end{align} then, singling out the first terms in the two last series and using Theorem $2$ $(16)$, we get \begin{align} \int_{0}^{\Large\frac{\pi}{4}}\!&\left(\!\frac1{x+\pi/4+i}+\frac1{x-\pi/4-i}\!\right) \tan x \:\mathrm dx\\ &=\tan \tau \log \left( \frac{4\tau-\pi}{4\tau+\pi}\right) +\frac{4\pi}{\pi^2 -4\tau^2}\log 3 \\&+\frac1{\pi}\gamma_1\!\left(\!\frac34,\frac12 +\frac{\tau}{\pi}\!\right) -\frac1{\pi}\gamma_1\!\left(\!\frac14,\frac12 +\frac{\tau}{\pi}\!\right)\tag{26}\\ &+\frac1{\pi}\gamma_1\!\left(\!\frac34,\frac12 -\frac{\tau}{\pi}\!\right) -\frac1{\pi}\gamma_1\!\left(\!\frac14,\frac12 -\frac{\tau}{\pi}\!\right) \end{align} and the substitution $\tau=\pi/4+i$ gives the desired result.

$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Box$

Achille Hui's conjecture is true.

Achille Hui has announced in the comments that the OP integral is equal to \begin{align} \frac{\arctan(\frac{\pi}{2}) - t\log\sqrt{1+\frac{\pi^2}{4}}}{1+t^2}+\frac{\pi^2}4 \sum_{n=0}^{\infty}\frac{ (2n+1)\left(\log\left(n+\frac34\right)-\log\left(n+\frac14\right)\right) }{ \left(1+\pi^2\left(n+\frac14\right)^2\right)\left(1+\pi^2\left(n+\frac34\right)^2\right) } \tag{27} \end{align} with $\displaystyle t := \tanh(1)$.

The first term in $(27)$, with a little algebra is seen to be equal to the sum of the first two terms on the right hand side of $(20)$.

We establish the veracity of the conjecture using Proposition $2$ and using the next result.

Proposition 3. We have \begin{align} &\frac{\pi^2}4 \sum_{n=0}^{\infty}\frac{ (2n+1)\left(\log\left(n+\frac34\right)-\log\left(n+\frac14\right)\right) }{ \left(1+\pi^2\left(n+\frac14\right)^2\right)\left(1+\pi^2\left(n+\frac34\right)^2\right) }\\\\ &=\frac{64 \pi^2\log 3}{(\pi^2+16)(9\pi^2+16)} \\\\ &+\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac34,\frac34 +\frac{i}{\pi}\!\right) -\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac14,\frac34 +\frac{i}{\pi}\!\right)\tag{28}\\\\ &+\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac34,\frac14 -\frac{i}{\pi}\!\right) -\frac{\Im}{2\pi}\gamma_1\!\left(\!\frac14,\frac14 -\frac{i}{\pi}\!\right) \end{align} with the poly-Stieltjes constant $$\gamma_1(a,b) = \lim_{N\to+\infty}\left(\sum_{n=1}^N \frac{\log (n+a)}{n+b}-\frac{\log^2 \!N}2\right).$$

Proof. Observe that the first term of the series on the left hand side of $(28)$, given by $n=0$, is just equal to $$\frac{64 \pi^2\log 3}{(\pi^2+16)(9\pi^2+16)}.$$ By a partial fraction decomposition, one may check that \begin{align} \frac{\pi^2}4 &\frac{ (2n+1) }{ \left(1+\pi^2\left(n+\frac14\right)^2\right)\left(1+\pi^2\left(n+\frac34\right)^2\right) } =\frac{\Im}{2\pi}\left(\!\frac1{n+\frac34+\frac{i}{\pi}}-\frac1{n+\frac14+\frac{i}{\pi}}\!\right) \tag{29} \end{align} then, multiplying $(29)$ by $\left(\log\!\left(n+\frac34\right)-\log\!\left(n+\frac14\right)\right)$ and summing from $n=1$ to $\infty$ we get, using Theorem $2$ $(16)$, the result $(28)$.

$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Box$

• @Lucian I've evaluated your challenging integral :-) – Olivier Oloa Sep 1 '15 at 1:44
• Defining enough special functions everything can be written in closed-form. I'm not convinced this is the simplest form one can get. – user 1591719 Jun 20 '16 at 18:40
• Je ne l'avais pas encore vu celle-là. Cela m'amuse toujours de voir la qualité de vos réponses et l'aisance qu'il semble s'y dégager même si j'imagine que celle-ci a dû vous prendre au moins trente minutes. :) – ParaH2 Oct 30 '16 at 23:47
• @Waiting Then, instead of writing useless comments, work smart and find a better solution. At least he gave a closed form, no matter if they do involve special functions, which by the way are very useful also because of this use. – Turing Apr 2 '18 at 10:31
• @Dr.WolfgangHintze Sorry but, as you can see, you have changed the integrand between the first and the last comment:) – Olivier Oloa Apr 24 '18 at 7:57

Too long for a comment: It is known that $\displaystyle\int_0^\frac\pi2\sin(\sin x)dx=\int_0^\frac\pi2\sin(\cos x)dx=\frac\pi2H_0(1)$,

and $\displaystyle\int_0^\frac\pi2\cos(\cos x)dx=\int_0^\frac\pi2\cos(\sin x)dx=\frac\pi2J_0(1)$, where H and J are the Struve and Bessel

functions respectively, so it is not out of the question that the existence of such closed forms, at

least in terms of these special functions, might have been one of the main initial triggers which

determined our anonymous source to investigate the nature of $\displaystyle\int_0^\frac\pi2\!\tan(\tan x)dx$, which turns

out to be $\ldots$ rather difficult, to say the very least. Indeed, the entire interval $\bigg(0,\dfrac\pi2\bigg)$ can be

broken up into an infinite number of sub-intervals, the first one of which is $\bigg(0,~\arctan\dfrac\pi2\bigg)$,

while all others are of the form $\bigg[\arctan\bigg(\dfrac\pi2+k\pi\bigg),~\arctan\bigg(\dfrac\pi2+\big(k+1\big)\pi\bigg)\bigg]$, for $k\in$ N.

The integral diverges towards $+\infty$ on the former, and towards $-\infty$ on the rest, but in such

a manner that $\displaystyle\int_0^{\alpha(k)}\!\tan(\tan x)dx\to\infty$ rather than $-\infty$, where $\alpha(k)=\arctan\bigg(\dfrac\pi2+k\pi\bigg)$.

This can be better visualized by plotting the function's graphic. But determining whether the

limit $\displaystyle\lim_{k\to\infty}\int_0^{\alpha(k)}\!\tan(\tan x)dx$ ultimately converges or diverges is by no means a trivial task

$\big($indeed, it is quite daunting$\big)$, so, discouraged, either by the integral's probable divergence, or

perhaps by its difficulty, or maybe by a bit of both, our anonymous source $\big($let's call him/her

Person X$\big)$ decides to focus its attention now on $\bigg(0,~\arctan\dfrac\pi2\bigg)$, but not before changing the

function into $~\dfrac1{\tan(\tan x)}$ , so as to avoid its divergence in $x=\arctan\dfrac\pi2$ . However, he now

faces another problem: its divergence in $0$. In order to fix this new impediment, the function

is further changed to $~\dfrac1{1+\tan(\tan x)}$ . Then, by a simple substitution, $\displaystyle\int_0^{\alpha(0)}\frac{dx}{1+\tan(\tan x)}$

becomes $\displaystyle\int_0^\frac\pi2\frac{dx}{(1+x^2)(1+\tan x)}$ , as already pointed out by ncmathsadist in the comment

section above. That such an improvised integral would indeed have a meaningful closed form

is no more likelier than for $\displaystyle\int_0^\frac\pi2\frac{dx}{1+\sin(\sin x)}=\int_0^\frac\pi2\frac{dx}{1+\sin(\cos x)}$ or $\displaystyle\int_0^\frac\pi2\frac{dx}{1+\cos(\cos x)}$

$=\displaystyle\int_0^\frac\pi2\frac{dx}{1+\cos(\sin x)}$ to possess one as well.

It is clear that the integral cannot be expressed in the form of elementary functions. This is another approach expanding on mwomath's comment. I feel this approach may be useful as it is a bit easier to understand in my opinion, as compared to Olivier Oloa's answer (which is completely fine). Sorry in advance for any steps I miss.

# Simplifying the original integral into three integrals:

$$\int_0^{\pi/2} \frac{dx}{(1+x^2)(1+\tan x)}$$ $$=\int_0^{\pi/2} \frac{\cos x dx}{(1+x^2)(\sin x+\cos x)}$$ $$= \int_0^{\pi/2} \frac{\cos x dx}{(1+x^2)(\sin x+\cos x)}.\frac{(\cos x-\sin x)}{(\cos x-\sin x)}$$ $$=\int_0^{\pi/2} \frac{\cos^2 x-\sin x \cos x }{(1+x^2)(\cos^2 x-\sin^2 x)}dx$$ $$=\int_0^{\pi/2} \frac{\cos^2 x-\sin x \cos x }{(1+x^2)(\cos 2x)}dx$$ $$=\int_0^{\pi/2} \frac{1}{2}\frac{(2\cos^2 x-1-2\sin x \cos x+1) }{(1+x^2)(\cos 2x)}dx$$ $$=\int_0^{\pi/2} \frac{1}{2}\frac{(\cos 2x-\sin 2x+1) }{(1+x^2)(\cos 2x)}dx$$

$$=\int_0^{\pi/2}\frac{1}{1+x^2}dx+\int_0^{\pi/2}\frac{\sec 2x}{1+x^2}dx-\int_0^{\pi/2}\frac{\tan 2x}{1+x^2}dx$$

# Evaluating $$\int_0^{\pi/2}\frac{1}{1+x^2}dx$$ :

We know that $$\int \frac{1}{1+x^2}dx=\arctan x$$

So, $$\int_0^{\pi/2}\frac{1}{1+x^2}dx=\arctan (\pi/2)$$

# Evaluating $$\int_0^{\pi/2}\frac{\sec 2x}{1+x^2}dx$$ :

The infinite sum of $$\sec x$$ is given as:

$$\sec x =\sum_{n=0}^{\infty} \frac{U_{2n}x^{2n}}{(2n)!}$$ where $$U_{n}$$ up/down number.

Similarly, $$\int_0^{\pi/2}\frac{\sec 2x}{1+x^2}dx=\int_0^{\pi/2} \sum_{n=0}^{\infty} \frac{2^n.U_{2n}x^{2n}}{(2n)!(1+x^2)}dx= \sum_{n=0}^{\infty} \int_0^{\pi/2} \frac{2^{2n}.U_{2n}x^{2n}}{(2n)!(1+x^2)}dx$$ $$\int \frac{x^{2n}}{1+x^2}dx=\frac{x^{2n+1}}{2n+1}\left( 1+\frac{2n+1}{2n+3}(-x^2)+\frac{2n+1}{2n+5}(-x^2)^2-\frac{2n+1}{2n+7}(-x^2)^6+\cdots\right)$$

We can express the infinite sum in the parenthesis in form of the hyper-geometric function:

$$_2F_1 \left(1, n+\frac{1}{2}; n+\frac{3}{2} ; -x^2 \right)$$

So, $$\int_0^{\pi/2}\frac{\sec 2x}{1+x^2}dx=\sum_{n=0}^{\infty} \int_0^{\pi/2} \frac{2^{2n}.U_{2n}x^{2n}}{(2n)!(1+x^2)}dx$$ $$= \sum_{n=0}^{\infty} \frac{2^{2n}.U_{2n}}{(2n)!}\frac{(\pi/2)^{2n+1}}{(2n+1)}._2F_1 \left(1, n+\frac{1}{2}; n+\frac{3}{2} ; -\pi^2/4 \right)$$

# Evaluating $$\int_0^{\pi/2}\frac{\tan 2x}{1+x^2}dx$$ :

The infinite sum of $$\tan x$$ is given as: $$\tan x =\sum_{n=0}^{\infty} \frac{U_{2n+1}x^{2n+1}}{(2n+1)!}$$ where $$U_{n}$$ up/down number.

Similarly, $$\int_0^{\pi/2}\frac{\tan 2x}{1+x^2}dx=\int_0^{\pi/2} \sum_{n=0}^{\infty} \frac{2^{2n+1}.U_{2n+1}x^{2n+1}}{(2n+1)!(1+x^2)}dx= \sum_{n=0}^{\infty} \int_0^{\pi/2} \frac{2^{2n+1}.U_{2n+1}x^{2n+1}}{(2n+1)!(1+x^2)}dx$$ $$\int \frac{x^{2n+1}}{1+x^2}dx=\frac{x^{2n+2}}{2n+2}\left( 1+\frac{2n+2}{2n+4}(-x^2)+\frac{2n+2}{2n+6}(-x^2)^2-\frac{2n+2}{2n+8}(-x^2)^6+\cdots\right)$$

We can express the infinite sum in the parenthesis in form of the hyper-geometric function:

$$_2F_1 \left(1, n+1; n+2 ; -x^2 \right)$$

So, $$\int_0^{\pi/2}\frac{\tan 2x}{1+x^2}dx=\sum_{n=0}^{\infty} \int_0^{\pi/2} \frac{2^{2n+1}.U_{2n+1}x^{2n+1}}{(2n+1)!(1+x^2)}dx$$ $$= \sum_{n=0}^{\infty} \frac{2^{2n+1}.U_{2n+1}}{(2n+1)!}\frac{(\pi/2)^{2n+2}}{(2n+2)}._2F_1 \left(1, n+1; n+2 ; -\pi^2/4 \right)$$

# Final expression:

$$\int_0^{\pi/2} \frac{dx}{(1+x^2)(1+\tan x)}$$ $$=\sum_{n=0}^{\infty} \frac{2^{2n}.U_{2n}}{(2n)!}\frac{(\pi/2)^{2n+1}}{(2n+1)}._2F_1 \left(1, n+\frac{1}{2}; n+\frac{3}{2} ; -\pi^2/4 \right)$$ $$+\sum_{n=0}^{\infty} \frac{2^{2n+1}.U_{2n+1}}{(2n+1)!}\frac{(\pi/2)^{2n+2}}{(2n+2)}._2F_1 \left(1, n+1; n+2 ; -\pi^2/4 \right)+\arctan (\pi/2) + C$$

or if you don't want to use hyper-geometric functions (in my opinion they just make the integral look a bit more clean and are a good way of representing certain infinite sums):

$$\int_0^{\pi/2} \frac{dx}{(1+x^2)(1+\tan x)}$$ $$=\sum_{n=0}^{\infty} \left( \frac{2^{2n}.U_{2n}.(\pi/2)^{2n}}{(2n)!}.\sum_{k=0}^{\infty}\frac{(-1)^{k}(\pi/2)^{2k+1}}{2(n+k)+1} \right)$$ $$+\sum_{n=0}^{\infty} \left(\frac{2^{2n+1}.U_{2n+1}(\pi/2)^n}{(2n+1)!} .\sum_{k=1}^{\infty}\frac{(-1)^{k-1}(\pi/2)^{2k}}{2(n+k)}\right) +\arctan (\pi/2) + C$$

A good fit for $$\frac{1}{1+\tan x}$$ in $$[0,\frac{\pi}{2}]$$ is $$1-\frac{2}{\pi}x$$

So

$$I_{approx}=\int_0^{\frac{\pi}{2}}\frac{1-\frac{2}{\pi}x}{1+x^2}dx=\arctan \frac{\pi}{2}-\frac{1}{\pi}\ln\left (1+ \frac{\pi^2}{4} \right )$$ Absolute error is about $$0.011$$