# An anti-derivative involving an arc tangent, a square root and a rational function.

This question is similar to A generalized Ahmed's integral .

Let $$a_1 \in {\mathbb R}_+$$, $$a_2 \in {\mathbb R}_+$$ and $$b_1 \in {\mathbb R}_+$$. Consider the following integrals: $$\begin{eqnarray} {\mathcal I}_1(a_1,b_1,b_2)&:=&\int\limits_0^{b_1} \frac{\arctan\left(\frac{\sqrt{a_1^2 \left(\xi ^2+1\right)+2}}{a_1 b_2}\right)}{\left(\xi ^2+1\right) \sqrt{a_1^2 \left(\xi ^2+1\right)+2}} d\xi\\ {\mathcal I}_2(a_1,b_1,b_2)&:=&\int\limits_0^{b_1} \frac{\arctan\left(\frac{a_1 \sqrt{b_2^2+\xi ^2+1}}{\sqrt{2}}\right)}{\left(\xi ^2+1\right) \sqrt{b_2^2+\xi ^2+1}} d\xi \end{eqnarray}$$ Now in both cases we firstly used a trigonometric substitution followed then by a tangent of a half angle substitution and then the identity $$\arctan(x)=1/(2 \imath) \log[(1+\imath x)/(1-\imath x)]$$. All that was pretty similar to the methods used in How to find the integral $\displaystyle\int_{0}^{\infty}\frac{\arctan{x}}{2+x^2}dx$ for example. We got the following results: $$\begin{eqnarray} &&{\mathcal I}_1(a_1,b_1,b_2)=\\ &&\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!-\frac{\sqrt{2}}{8} \sum\limits_{i=1}^4 \sum\limits_{j=1}^4 (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor +\left\lfloor \frac{j-1}{2}\right\rfloor +i}\cdot {\mathfrak F}^{(0,\frac{\sqrt{a_1^2 b_1^2+a_1^2+2}-\sqrt{a_1^2+2}}{a_1 b_1})}_{i (-1)^j e^{i (-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor } \arctan\left(\frac{a_1 b_2}{\sqrt{a_1^2+2}}\right)},\frac{i (-1)^{i-1} \left(\sqrt{a_1^2+2}+\sqrt{2} (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor }\right)}{a_1}}-\\ &&\frac{\arctan\left(\frac{a_1 b_2}{\sqrt{a_1^2+2}}\right)+\frac{\pi }{2}}{\sqrt{2} } \cdot \left(\right.\\ &&\left. \arctan\left(\frac{\left(\sqrt{a_1^2+2}-\sqrt{2}\right) \left(\sqrt{a_1^2 \left(b_1^2+1\right)+2}-\sqrt{a_1^2+2}\right)}{a_1^2 b_1}\right)-\right.\\ &&\left.\arctan\left(\frac{\left(\sqrt{a_1^2+2}+\sqrt{2}\right) \left(\sqrt{a_1^2 \left(b_1^2+1\right)+2}-\sqrt{a_1^2+2}\right)}{a_1^2 b_1}\right)\right.\\ &&\left.\right) \end{eqnarray}$$ Likewise $$\begin{eqnarray} &&{\mathcal I}_2(a_1,b_1,b_2)=\\ &&\frac{1}{4 b_2} \sum\limits_{i=1}^4 \sum\limits_{j=1}^4 (-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor +i} {\mathfrak F}^{(0,\frac{i \left(\sqrt{b_2^2+1}-\sqrt{b_1^2+b_2^2+1}\right)}{b_1})}_{i (-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor +j+1} e^{i (-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor } \arctan\left(\frac{a_1 \sqrt{b_2^2+1}}{\sqrt{2}}\right)}, \sqrt{b_2^2+1} (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor }+b_2 (-1)^{i-1}}+\\ &&\frac{\arctan\left(\frac{a_1 \sqrt{b_2^2+1}}{\sqrt{2}}\right)}{b_2} \cdot \left(\right.\\ % &&\left.\arctan\left(\frac{\left(\sqrt{b_2^2+1}+b_2\right) \left(\sqrt{b_2^2+1}-\sqrt{b_1^2+b_2^2+1}\right)}{b_1}\right)-\right.\\ &&\left.\arctan\left(\frac{\left(\sqrt{b_2^2+1}-b_2\right) \left(\sqrt{b_2^2+1}-\sqrt{b_1^2+b_2^2+1}\right)}{b_1}\right)\right.\\ &&\left.\right) \end{eqnarray}$$

Here $${\mathfrak F}^{(A,B)}_{a,b} := \int\limits_A^B \frac{\log(z+a)}{z+b} dz$$ and is expressed through di-logarithms as explained in An integral involving a Gaussian, error functions and the Owen's T function. .

For[count = 1, count <= 100, count++,
{a, b, a1, b1, b2} = RandomReal[{0, 1}, 5, WorkingPrecision -> 50];
x1 = NIntegrate[
ArcTan[Sqrt[2 + a1^2 (1 + xi^2)]/(a1 b2)]/( (1 + xi^2) Sqrt[
2 + a1^2 (1 + xi^2)]), {xi, 0, b1}];
x11 = -Sqrt[2]/
8 Sum[(-1)^(i + Floor[(i - 1)/2] + Floor[(j - 1)/2])
FF[0, (-Sqrt[2 + a1^2] + Sqrt[2 + a1^2 + a1^2 b1^2])/(a1 b1),
I (-1)^j Exp[
I (-1)^Floor[(j - 1)/2] ArcTan[(a1 b2 )/Sqrt[
2 + a1^2]]], (-1)^(i - 1) I/
a1 (Sqrt[2 + a1^2] + (-1)^Floor[(i - 1)/2] Sqrt[2])], {i, 1,
4}, {j, 1, 4}] + -( ArcTan[(a1 b2)/Sqrt[2 + a1^2]] + Pi/2) 1/
Sqrt[2]  (-ArcTan[((-Sqrt[2 + a1^2] + Sqrt[
2 + a1^2 (1 + b1^2)]) (Sqrt[2 + a1^2] + Sqrt[2]))/(
b1 a1^2)] +
ArcTan[((-Sqrt[2 + a1^2] + Sqrt[2 + a1^2 (1 + b1^2)]) (Sqrt[
2 + a1^2] - Sqrt[2]))/( b1 a1^2)]);
x2 = NIntegrate[
ArcTan[(a1 Sqrt[1 + xi^2 + b2^2])/Sqrt[2]]/( (1 + xi^2) Sqrt[
1 + xi^2 + b2^2] ), {xi, 0, b1}];
x21 = 1/(4 b2)
Sum[(-1)^(i + Floor[(j - 1)/2])
FF[0, (I (Sqrt[1 + b2^2] - Sqrt[1 + b1^2 + b2^2]))/b1,
I (-1)^(1 + j + Floor[(j - 1)/2])
Exp[I (-1)^
Floor[(j - 1)/2] (ArcTan[( a1 Sqrt[1 + b2^2])/Sqrt[
2]])], (-1)^(i - 1) b2 + (-1)^Floor[(i - 1)/2] Sqrt[
1 + b2^2]], {i, 1, 4}, {j, 1, 4}] + (ArcTan[(
a1 Sqrt[1 + b2^2])/Sqrt[2]]) 1/
b2  ( ArcTan[((Sqrt[1 + b2^2] - Sqrt[1 + b1^2 + b2^2]) (Sqrt[
1 + b2^2] + b2))/b1 ] -
ArcTan[((Sqrt[1 + b2^2] - Sqrt[1 + b1^2 + b2^2]) (Sqrt[
1 + b2^2] - b2))/b1]);
If[Abs[x11/x1 - 1] > 10^(-4),
Print["results do not match..", {a, b, a1, b1, b2}, {x1, x11}];
Break[]];
If[Abs[x21/x2 - 1] > 10^(-4),
Print["results do not match..", {a, b, a1, b1, b2}, {x2, x21}];
Break[]];
If[Mod[count, 10] == 0, PrintTemporary[count]];
];


Now, having said all this the question would be is it possible to simplify the result any further and express it through di-logarithms in a manifest way?