Compute close-form of $\int_0^{\frac\pi2}\frac{dt}{\sin t+\cos t+\tan t+\cot t+\csc t+\sec t}$ I came across the improper trigonometric integral recently shared in a Chinese web forum
\begin{align}
\int_0^{\frac\pi2}\frac{dt}{\sin t+\cos t+\tan t+\cot t+\csc t+\sec t}\\
\end{align}
which amuses me because of its appearance. What is more amusing is the claim, without providing the proof, that is has the close-form result
\begin{align}
\frac{\sqrt{8\sqrt2+2\sqrt7}}{7^{3/4} }\tanh^{-1}  \frac{\sqrt{2\sqrt7(4\sqrt2-5)}}{4\sqrt2-5 +\sqrt7}
+\frac{\sqrt{8\sqrt2-2\sqrt7}}{7^{3/4} }\tan^{-1}\frac{\sqrt{2\sqrt7(4\sqrt2-5)}}{4\sqrt2-5 - \sqrt7}
\end{align}
I was able to verify it numerically; yet rather curious in how it could ever be derived. Based on my knowledge and experience, I do not assume it would be easy.
I was able to find an unsolved post here from a long time ago, which only reexpresses the corresponding  indefinite integral via the tangent half-angle substitution as
$$\int\frac{2t(1-t)}
{2 t^4-3 t^3+3 t^2+t+1}dt$$
but gives up due to the complexity in partial fractionalization. I am doubtful that this approach would lead to the explicit expression claimed above. I am interested in any suitable methods producing the close-form.
 A: This feels more like a comment to Travis Willse's excellent answer, which essentially solves the problem, but here's the rest of the calculation:
So far we have ($u = \frac{\tan \left(\frac{\pi}{8} - \frac{t}{2}\right)}{\sqrt{2}-1}$)
\begin{align}
I &\equiv \int \limits_0^{\pi/2} \frac{\mathrm{d} t}{\sin(t) + \cos(t) + \tan(t) + \cot(t) + \sec(t) + \csc(t)} \\
&= 2 \int \limits_0^{\pi/4} \frac{\mathrm{d} t}{\sin(t) + \cos(t) + \tan(t) + \cot(t) + \sec(t) + \csc(t)} \\
&= \frac{2 \sqrt{2} \beta^2}{\sqrt{7}} \int \limits_0^1 \frac{1-u^2}{u^4 + \beta^4} \, \mathrm{d} u = \frac{2 \sqrt{2} \beta^2}{\sqrt{7}} \int \limits_0^1 \frac{1-u^2}{(u^2 + \mathrm{i} \beta^2) (u^2 - \mathrm{i} \beta^2)} \, \mathrm{d} u
\end{align}
with $\beta = \sqrt{\frac{5 + 4 \sqrt{2}}{\sqrt{7}}}$. We now need $a_{1/2} \in \mathbb{C}$ such that $a_1 (u^2 + \mathrm{i} \beta^2) + a_2 (u^2 - \mathrm{i} \beta^2) = 1 - u^2$ holds. The solution is $a_{1/2} = - \frac{1}{2} \left(1 \pm \frac{\mathrm{i}}{\beta^2}\right)$, so we can write
\begin{align}
I &= - \frac{2 \sqrt{2} \beta^2}{\sqrt{7}} \operatorname{Re} \left[\left(1 + \frac{\mathrm{i}}{\beta^2}\right) \int \limits_0^1 \frac{\mathrm{d} u}{u^2 - \mathrm{i} \beta^2} \right] = - \frac{2 \sqrt{2} \beta^2}{\sqrt{7}} \operatorname{Re} \left[\left(1 + \frac{\mathrm{i}}{\beta^2}\right) \int \limits_0^1 \frac{\mathrm{d} u}{u^2 + \left(\frac{1 - \mathrm{i}}{\sqrt{2}} \beta\right)^2} \right] \\
&= - \frac{2 \sqrt{2} \beta^2}{\sqrt{7}} \operatorname{Re} \left[\left(1 + \frac{\mathrm{i}}{\beta^2}\right) \frac{1 + \mathrm{i}}{\sqrt{2} \beta} \arctan \left(\frac{1 + \mathrm{i}}{\sqrt{2} \beta}\right) \right] \\
&= - \frac{2}{\sqrt{7}} \operatorname{Re} \left[\left(\beta - \beta^{-1} + \mathrm{i} \left(\beta + \beta^{-1}\right)\right) \arctan \left(\frac{1 + \mathrm{i}}{\sqrt{2} \beta}\right) \right] \\
&= - \frac{1}{\sqrt{7}} \operatorname{Re} \left[\left(\beta - \beta^{-1} + \mathrm{i} \left(\beta + \beta^{-1}\right)\right) \left(\arctan \left(\frac{\sqrt{2}}{\beta - \beta^{-1}}\right) + \mathrm{i} \operatorname{artanh} \left(\frac{\sqrt{2}}{\beta + \beta^{-1}}\right)\right) \right] \\
&= \frac{1}{\sqrt{7}} \left[\left(\beta + \beta^{-1}\right) \operatorname{artanh} \left(\frac{\sqrt{2}}{\beta + \beta^{-1}}\right)- \left(\beta - \beta^{-1}\right) \arctan \left(\frac{\sqrt{2}}{\beta - \beta^{-1}}\right)\right] \, .
\end{align}
In the penultimate step we have used
$$ \arctan(a + \mathrm{i} b) = \frac{1}{2} \left[\arctan \left(\frac{2 a}{1 - a^2 - b^2}\right) + \mathrm{i} \operatorname{artanh} \left(\frac{2 b}{1 + a^2 + b^2}\right)\right] $$
from here. Since $\beta \pm \beta^{-1} = \sqrt{2} \sqrt{4 \sqrt{\frac{2}{7}} \pm 1}$, we obtain
$$ I = \sqrt{\frac{2}{7}} \left[\sqrt{4 \sqrt{\frac{2}{7}} + 1} \operatorname{arcoth} \left(\sqrt{4 \sqrt{\frac{2}{7}} + 1}\right) - \sqrt{4 \sqrt{\frac{2}{7}} - 1} \operatorname{arccot} \left(\sqrt{4 \sqrt{\frac{2}{7}} - 1}\right)\right] \, , $$
which is a simplified version of the final result given in the question.
A: Too long for a comment
Playing a little bit with expression one can see that

$$\begin{align}
\sin x+\cos x+\tan x&+\cot x+\csc x+\sec x \\
\end{align}
=\sin x+\cos x +\frac{2}{\sin x+\cos x -1}=\sqrt{2}\sin\Big(x+\frac{\pi}{4}\Big)+\frac{2}{\sqrt{2}\sin\Big(x+\frac{\pi}
{4}\Big)-1}$$

Plugging this in integral we get,
$$I=\int_{0}^{\frac{\pi}{2}} 
\frac{\sqrt{2}\sin\Big(x+\frac{\pi}
{4}\Big)-1}{2\sin^{2}\Big(x+\frac{\pi}
{4}\Big)-\sqrt{2}\sin\Big(x+\frac{\pi}
{4}\Big)+2}dx$$
Let $x=t-\frac{\pi}{4}$ $\implies dx=dt$
$$ I= \int_{\frac{\pi}{4}}^{\frac{3\pi}{4}} 
\frac{\sqrt{2}\sin t-1}{2\sin^{2}t-\sqrt{2}\sin t+2}dt$$
We can split this in the following two integrals
$$I= \int_{\frac{\pi}{4}}^{\frac{3\pi}{4}} 
\frac{\sqrt{2}\sin t}{2\sin^{2}t-\sqrt{2}\sin t+2}dt-\int_{\frac{\pi}{4}}^{\frac{3\pi}{4}} 
\frac{1}{2\sin^{2}t-\sqrt{2}\sin t+2}dt$$
I'm not sure how to calculate above two integrals separately.
Initially I thought that we have two integrals and two nested square root terms In given result so they should be equal but none of the individual integral is equal to the terms in result.Numerically these two integrals evaluate $0.8448$ and $0.6688$ and terms in result are $0.6054$ and $-0.4294$. Notice their sum are equal to each other so we are in right direction.
A: Let's simply assume the roots are known and are $$\rho_1,\rho_2,\rho_3,\rho_4$$ and that way we evaluate
$$\int \dfrac{2t(1-t)}{(t-\rho_1)(t-\rho_2)(t-\rho_3)(t-\rho_4)}dt.$$
By fraction decomposition,
$$2t(1-t)=A(t-\rho_2)(t-\rho_3)(t-\rho_4)+B(t-\rho_1)(t-\rho_3)(t-\rho_4)+C(t-\rho_1)(t-\rho_2)(t-\rho_4)+D(t-\rho_1)(t-\rho_2)(t-\rho_3)$$ or,
$$A=\dfrac{2\rho_1(1-\rho_1)}{(\rho_1-\rho_2)(\rho_1-\rho_3)(\rho_1-\rho_4)}$$
$$B=\dfrac{2\rho_2(1-\rho_2)}{(\rho_2-\rho_1)(\rho_2-\rho_3)(\rho_2-\rho_4)}$$
$$C=\dfrac{2\rho_3(1-\rho_3)}{(\rho_3-\rho_1)(\rho_3-\rho_2)(\rho_3-\rho_4)}$$
$$D=\dfrac{2\rho_4(1-\rho_4)}{(\rho_4-\rho_1)(\rho_4-\rho_2)(\rho_4-\rho_3)}$$
and so
$$\int\frac{2t(1-t)}{2 t^4-3 t^3+3 t^2+t+1}dt = \dfrac{2\rho_1(1-\rho_1)}{(\rho_1-\rho_2)(\rho_1-\rho_3)(\rho_1-\rho_4)}\log|t-\rho_1|+\dfrac{2\rho_2(1-\rho_2)}{(\rho_2-\rho_1)(\rho_2-\rho_3)(\rho_2-\rho_4)}\log|t-\rho_2|+\dfrac{2\rho_3(1-\rho_3)}{(\rho_3-\rho_1)(\rho_3-\rho_2)(\rho_3-\rho_4)}\log|t-\rho_3|+\dfrac{2\rho_4(1-\rho_4)}{(\rho_4-\rho_1)(\rho_4-\rho_2)(\rho_4-\rho_3)}\log|t-\rho_4|+c$$ Now what remains are the roots given by
$$2 t^4-3 t^3+3 t^2+t+1=0.$$ I tried other substitutions which inevitably led to the same form.
Edit: I did not have the patience to evaluate the roots or to then compute the coefficients. However, wolfram kindly provides the simple expressions for the roots as
$$\dfrac{3+\epsilon \sqrt{7}i}{8}+ \dfrac{\varepsilon}{2}\sqrt{-\frac{7}{8}+\epsilon \frac{11\sqrt{7}i}{8}}$$ where $\epsilon,\varepsilon =\pm 1$ independently.
A: 
Evaluate
$$\int_0^{\pi / 2} \frac{dx}{\sin x + \cos x + \tan x + \sec x + \csc x + \cot x} .$$

As in the linked question, applying the classical Weierstrass substitution, $$x = 2 \arctan t, \qquad dx = \frac{2 \,dt}{t^2 + 1},$$ transforms the integral to
$$
\int_0^1 \frac{2 t (1 - t)}{2 t^4 - 3 t^3 + 3 t^2 + t + 1}.
$$
One can show that the Galois group of the polynomial $$f(t) := 2 t^4 - 3 t^2 + 3 t^2 + t + 1$$ in the denominator of the integrand
is $D_8$, suggesting applying a transformation that takes advantage of that symmetry.*
The following shows one way of doing so, in particular transforming the integrand to one to which the Method of Partial Fractions can be applied somewhat more easily than the one in $t$. I don't know whether the particular substitution used here is in any sense the nicest choice.
Let $\alpha := \cot \frac{3 \pi}{8} = \sqrt{2} - 1$. Applying to the original integral the substitution
$$x = \frac{\pi}{4} - 2 \arctan (\alpha u), \qquad dx = -\frac{2 \alpha \,du}{\alpha^2 u^2 + 1} ,$$
simplifying considerably, and taking advantage of the evenness of the integration in $u$ gives that the integral is equal to
$$\frac{2 (8 + 5 \sqrt{2})}{7} \int_0^1 \frac{1 - u^2}{u^4 + \beta^4} du , \qquad \textrm{where } \beta := \frac{\sqrt{5 + 4 \sqrt{2}}}{\sqrt[4]{7}} .$$ Remark 1 The substitution $x \rightsquigarrow u$ is related to the Weierstrass substitution, $x \rightsquigarrow t$ by the linear fractional transformation $$t = \frac{\alpha (1 - u)}{\alpha^2 u + 1} .$$
Remark 2 Perhaps despite appearances the substitution $x \rightsquigarrow u$ is not particularly clever: It is the composition of a translation that centers the domain of integration on the origin, the classical Weierstrass substitution, and a dilation to make the coefficients and limits in the resulting integrand nicer.
Over $\Bbb Q(\beta) = \Bbb Q(\beta, \sqrt{2})$ (or just $\Bbb R$), the denominator of the integrand in $u$ factors into irreducible polynomials as
$$u^4 + \beta^4 = (u^2 + \sqrt{2} \beta u + \beta^2) (u^2 - \sqrt{2} \beta u + \beta^2),$$ so the rest of the computation can be handled with standard techniques: Applying the Method of Partial Fractions gives the decomposition
$$\frac{1 - u^2}{u^4 + \beta^4} = \frac{A u + B}{u^2 + \sqrt{2} \beta u + \beta^2} + \frac{C u + D}{u^2 - \sqrt{2} \beta u + \beta^2} .$$
Evenness of the integrand implies that $C = -A, D = B$, reducing the equation in the unknown coefficients to a $2 \times 2$ system in $A, B$, and some elementary algebra gives
$$A = -\frac{\beta^2 + 1}{2 \sqrt{2} \beta^3}, \qquad B = -\frac{1}{\beta^2} .$$
Separating each summand into the sum of a scalar multiple of $$\frac{u}{u^2 \pm \sqrt{2} \beta u + \beta^2} \qquad \textrm{and one of} \qquad \frac{1}{u^2 \pm \sqrt{2} \beta u + \beta^2} ,$$ and integrating respectively gives antiderivatives
$$\frac{1}{2} \log \left[\sqrt{2} \beta u \pm (\beta^2 + u^2)\right] \qquad \textrm{and} \qquad \arctan \left(1 \pm \frac{\sqrt{2} u}{\beta}\right) .$$ We can combine the two $\log$ terms with the identity $\operatorname{artanh} x = \frac{1}{2} \log \left(\frac{1 + x}{1 - x}\right)$, yielding
$$\operatorname{artanh} \left(\frac{u^2 + \beta^2}{\sqrt{2} \beta u}\right),$$
and we can combine the two $\arctan$ terms with the arctan sum identity, $\arctan x + \arctan y = \arctan \left(\frac{x + y}{1 - xy}\right)$, yielding
$$
\arctan \left(\frac{\beta^2}{u^2}\right) .
$$
Putting this all together gives essentially the given exact form, and a numerical evaluation suggests that the expressions indeed agree, with value $0.1760244214\ldots$.

*The discriminant of the irreducible quartic $f$ is $\Delta := 2^5 7^3$; now, (a) $f$ remains irreducible over $\Bbb Q(\sqrt{\Delta}) = \Bbb Q(\sqrt{14})$, and (b) the cubic resolvent of $f$ factors over $\Bbb Q$ as a product of an irreducible quartic and a linear polynomial (up to a scalar multiple, $(2 x − 1) (4 x^2 − 4 x − 13)$), and these two facts together imply that $\operatorname{Gal}(f) \cong D_8$.
