Integrate $\int\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}dx$ 
Solve the indefinite integral
$$
I=\int\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}\;dx
$$

My Attempt:
$$
\begin{align}
I&=\int\frac{1}{\sin x+\cos x+\frac{1}{\sin x \cos x}+\frac{\sin x +\cos x}{\sin x\cos x}}\;dx\\
\\
&=\int\frac{\sin x\cos x}{\left(\sin x+\cos x\right)\left(\sin x\cos x \right)+1+\left(\sin x+\cos x\right)}\;dx
\end{align}
$$
How can I complete the solution from here?
 A: If you can't see anything simpler: when you have a rational function of sin and cos, you can always use the tangent half-angle substitution $t = \tan (x/2)$.  Then $$\sin x = \frac{2t}{1+t^2}, \cos x = \frac{1-t^2}{1+t^2}, dx = \frac{2 dt}{1+t^2}.$$ Substituting these converts your integral into the integral of a rational function of $t$, which can then be integrated by partial fractions.
A: You can use Euler's identities and expand it in terms of complex exponents like (after some simplifications):
$$\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}=\frac{e^{\mathrm i x} \left((1+\mathrm i) e^{2 \mathrm i x}-2 \mathrm i e^{\mathrm i x}+(\mathrm i-1)\right)}{e^{4 \mathrm i x}-(1+\mathrm i) e^{3 \mathrm i x}+6 \mathrm i e^{2 \mathrm i x}+(1-\mathrm i) e^{\mathrm i x}-1}$$
So 
$$
\begin{eqnarray}
\int\!\!\frac{1}{\sin x\!+\!\cos x\!+\!\tan x\!+\!\cot x\!+\!\csc x\!+\!\sec x}\!\mathrm dx&=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(1+\mathrm i) e^{2 \mathrm i x}-2 \mathrm i e^{\mathrm i x}+(\mathrm i-1)}{e^{4 \mathrm i x}-(1+\mathrm i) e^{3 \mathrm i x}+6 \mathrm i e^{2 \mathrm i x}+(1-\mathrm i) e^{\mathrm i x}-1}\!\!\mathrm de^{\mathrm i x}\!\!=\\
&=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(1+\mathrm i) t^{2}-2 \mathrm i t+(\mathrm i-1)}{t^{4}-(1+\mathrm i) t^{3}+6 \mathrm i t^{2}+(1-\mathrm i) t^{}-1} \!\!\mathrm dt&=&\\
&=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(t-t_{11})(t-t_{12})}{(t-t_{21})(t-t_{22})(t-t_{32})(t-t_{42})} \!\!\mathrm dt
\end{eqnarray}
$$
After that you can use partial fraction expansion to simplify the answer (Mathematica gives 4 distinct roots for denominator).
A: You want
$\begin{align}
 \int\frac{dx}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}
&= \int\frac{dx}{\sin x+\cos x+\frac{\sin x}{\cos x}
+\frac{\cos x}{\sin x}+\frac1{\sin x}+\frac1{\cos x}}\\
&= \int\frac{\sin x \cos x\ dx}{\sin^2 x \cos x+\cos^2 x \sin x+\sin^2 x
+\cos^2 x+\cos x+\sin x}\\
&= \int\frac{\sin x \cos x\ dx}{\sin x \cos x(\sin x+ \cos x)+1+\cos x+\sin x}\\
&= \int\frac{\sin x \cos x\ dx}{(\sin x \cos x+1)(\sin x+ \cos x)+1}\\
\end{align}
$.
Applying substitutions
$\sin x = \frac{2t}{1+t^2}, \cos x = \frac{1-t^2}{1+t^2}, dx = \frac{2 dt}{1+t^2}$,
this becomes
$\begin{align}
\int\frac{\sin x \cos x\ dx}{(\sin x \cos x+1)(\sin x+ \cos x)+1}
&=\int\frac{\frac{(2t)(1-t^2)(2dt)}{(1+t^2)^3}}
{(\frac{(2t)(1-t^2)}{(1+t^2)^2}+1)(\frac{2t}{1+t^2}+ \frac{1-t^2}{1+t^2})+1}\\
&=\int\frac{(2t)(1-t^2)(2dt)}
{((2t)(1-t^2)+(1+t^2)^2)(1+2t-t^2)+(1+t^2)^3}\\
&=\int\frac{4t(1-t^2)dt}
{((2t-2t^3)+1+2t^2+t^4)(1+2t-t^2)+1+3t^2+3t^4+t^6}\\
&=\int\frac{4t(1-t^2)dt}
{(1+2t+2t^2-2t^3+t^4)(1+2t-t^2)+1+3t^2+3t^4+t^6}\\
&=\int\frac{4t(1-t^2)dt}
{2 (t+1) (2 t^4-3 t^3+3 t^2+t+1)} \quad \text{ (according to Wolfram Alpha)}\\
&=\int\frac{2t(1-t)dt}
{2 t^4-3 t^3+3 t^2+t+1}\\
\end{align}
$.
According to Wolfram Alpha,
that quartic can be factored
as the product of two quadratics,
but the coefficients look irrational.
I'll leave it at this.
A: Try $U$ substitution $x = 2 \arctan U$
