\(\int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx\) [577]

Optimal result
Mathematica [A] (verified)
Rubi [A] (warning: unable to verify)
Maple [C] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-1)]
Maxima [F(-2)]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 21, antiderivative size = 69 \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\frac {\cos (x)}{2 \sqrt {\sin (2 x)}}+\frac {\cos (x) \cot (x)}{3 \sqrt {\sin (2 x)}}-\frac {5 \text {arctanh}\left (\frac {\sqrt {\tan (x)}}{\sqrt {2}}\right ) \sin (x)}{2 \sqrt {2} \sqrt {\sin (2 x)} \sqrt {\tan (x)}} \] Output:

1/2*cos(x)/sin(2*x)^(1/2)+1/3*cos(x)*cot(x)/sin(2*x)^(1/2)-5/4*arctanh(1/2 
*tan(x)^(1/2)*2^(1/2))*sin(x)*2^(1/2)/sin(2*x)^(1/2)/tan(x)^(1/2)
 

Mathematica [A] (verified)

Time = 1.04 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.16 \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\frac {1}{4} \sqrt {\sin (2 x)} \left (\left (1+\frac {2 \cot (x)}{3}\right ) \csc (x)-\frac {5 \arctan \left (\frac {\sqrt {\tan \left (\frac {x}{2}\right )}}{\sqrt {-1+\tan ^2\left (\frac {x}{2}\right )}}\right ) \sqrt {-\frac {\cos (x)}{2+2 \cos (x)}} \sec (x)}{\sqrt {\tan \left (\frac {x}{2}\right )}}\right ) \] Input:

Integrate[(Csc[x]^2*Sec[x])/(Sqrt[Sin[2*x]]*(-2 + Tan[x])),x]
 

Output:

(Sqrt[Sin[2*x]]*((1 + (2*Cot[x])/3)*Csc[x] - (5*ArcTan[Sqrt[Tan[x/2]]/Sqrt 
[-1 + Tan[x/2]^2]]*Sqrt[-(Cos[x]/(2 + 2*Cos[x]))]*Sec[x])/Sqrt[Tan[x/2]])) 
/4
 

Rubi [A] (warning: unable to verify)

Time = 0.60 (sec) , antiderivative size = 55, normalized size of antiderivative = 0.80, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4890, 25, 4889, 518, 1585, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (\tan (x)-2)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sec (x)}{\sin (x)^2 \sqrt {\sin (2 x)} (\tan (x)-2)}dx\)

\(\Big \downarrow \) 4890

\(\displaystyle \frac {\sin (x) \int -\frac {\csc (x) \sec (x) \sqrt {\tan (x)}}{\sin (x)^2 (2-\tan (x))}dx}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {\sin (x) \int \frac {\csc (x) \sec (x) \sqrt {\tan (x)}}{\sin (x)^2 (2-\tan (x))}dx}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

\(\Big \downarrow \) 4889

\(\displaystyle -\frac {\sin (x) \int \frac {\tan ^2(x)+1}{(2-\tan (x)) \tan ^{\frac {5}{2}}(x)}d\tan (x)}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

\(\Big \downarrow \) 518

\(\displaystyle -\frac {2 \sin (x) \int \frac {\cot ^4(x) \left (\tan ^2(x)+1\right )}{2-\tan (x)}d\sqrt {\tan (x)}}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

\(\Big \downarrow \) 1585

\(\displaystyle -\frac {2 \sin (x) \int \left (\frac {\cot ^4(x)}{2}+\frac {\cot ^2(x)}{4}-\frac {5}{4 (\tan (x)-2)}\right )d\sqrt {\tan (x)}}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {2 \sin (x) \left (\frac {5 \text {arctanh}\left (\frac {\sqrt {\tan (x)}}{\sqrt {2}}\right )}{4 \sqrt {2}}-\frac {1}{6} \cot ^3(x)-\frac {\cot (x)}{4}\right )}{\sqrt {\sin (2 x)} \sqrt {\tan (x)}}\)

Input:

Int[(Csc[x]^2*Sec[x])/(Sqrt[Sin[2*x]]*(-2 + Tan[x])),x]
 

Output:

(-2*((5*ArcTanh[Sqrt[Tan[x]]/Sqrt[2]])/(4*Sqrt[2]) - Cot[x]/4 - Cot[x]^3/6 
)*Sin[x])/(Sqrt[Sin[2*x]]*Sqrt[Tan[x]])
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 518
Int[((e_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_)*((a_) + (b_.)*(x_)^2)^(p_.), 
 x_Symbol] :> Simp[2/e^(n + 2*p + 1)   Subst[Int[x^(2*m + 1)*(e*c + d*x^2)^ 
n*(a*e^2 + b*x^4)^p, x], x, Sqrt[e*x]], x] /; FreeQ[{a, b, c, d, e}, x] && 
IGtQ[p, 0] && ILtQ[n, 0] && IntegerQ[m + 1/2]
 

rule 1585
Int[((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (c_.)*(x_)^4)^(p 
_.), x_Symbol] :> Int[ExpandIntegrand[(f*x)^m*(d + e*x^2)^q*(a + c*x^4)^p, 
x], x] /; FreeQ[{a, c, d, e, f, m, q}, x] && IGtQ[p, 0] && IGtQ[q, -2]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4889
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors 
[Tan[v], x]}, Simp[d/Coefficient[v, x, 1]   Subst[Int[SubstFor[1/(1 + d^2*x 
^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /;  !FalseQ[v] && FunctionOfQ[N 
onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] &&  !MatchQ[ 
u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I 
ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
 

rule 4890
Int[(u_)*((c_.)*sin[v_])^(m_), x_Symbol] :> With[{w = FunctionOfTrig[u*(Sin 
[v/2]^(2*m)/(c*Tan[v/2])^m), x]}, Simp[(c*Sin[v])^m*((c*Tan[v/2])^m/Sin[v/2 
]^(2*m))   Int[u*(Sin[v/2]^(2*m)/(c*Tan[v/2])^m), x], x] /;  !FalseQ[w] && 
FunctionOfQ[NonfreeFactors[Tan[w], x], u*(Sin[v/2]^(2*m)/(c*Tan[v/2])^m), x 
]] /; FreeQ[c, x] && LinearQ[v, x] && IntegerQ[m + 1/2] &&  !SumQ[u] && Inv 
erseFunctionFreeQ[u, x]
 
Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.41 (sec) , antiderivative size = 396, normalized size of antiderivative = 5.74

method result size
default \(\frac {\sqrt {-\frac {\tan \left (\frac {x}{2}\right )}{\tan \left (\frac {x}{2}\right )^{2}-1}}\, \left (-380 \sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\, \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \operatorname {EllipticF}\left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right ) \tan \left (\frac {x}{2}\right )+240 \sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\, \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \operatorname {EllipticE}\left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right ) \tan \left (\frac {x}{2}\right )+\sqrt {2}\, \sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\, \sqrt {\tan \left (\frac {x}{2}\right )^{3}-\tan \left (\frac {x}{2}\right )}\, \left (\munderset {\underline {\hspace {1.25 ex}}\alpha =\operatorname {RootOf}\left (\textit {\_Z}^{4}+\textit {\_Z}^{3}+2 \textit {\_Z}^{2}-\textit {\_Z} +1\right )}{\sum }\frac {\left (22 \underline {\hspace {1.25 ex}}\alpha ^{3}+39 \underline {\hspace {1.25 ex}}\alpha ^{2}+22 \underline {\hspace {1.25 ex}}\alpha +17\right ) \left (\underline {\hspace {1.25 ex}}\alpha ^{3}+2 \underline {\hspace {1.25 ex}}\alpha -3\right ) \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {1-\tan \left (\frac {x}{2}\right )}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \operatorname {EllipticPi}\left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, -\frac {1}{4} \underline {\hspace {1.25 ex}}\alpha ^{3}-\frac {1}{2} \underline {\hspace {1.25 ex}}\alpha +\frac {3}{4}, \frac {\sqrt {2}}{2}\right )}{\sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}}\right ) \tan \left (\frac {x}{2}\right )+40 \sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\, \tan \left (\frac {x}{2}\right )^{4}+120 \tan \left (\frac {x}{2}\right )^{3} \sqrt {\tan \left (\frac {x}{2}\right )^{3}-\tan \left (\frac {x}{2}\right )}-120 \sqrt {\tan \left (\frac {x}{2}\right )^{3}-\tan \left (\frac {x}{2}\right )}\, \tan \left (\frac {x}{2}\right )-40 \sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\right )}{480 \tan \left (\frac {x}{2}\right )^{2} \sqrt {\tan \left (\frac {x}{2}\right )^{3}-\tan \left (\frac {x}{2}\right )}}\) \(396\)

Input:

int(csc(x)^2*sec(x)/sin(2*x)^(1/2)/(-2+tan(x)),x,method=_RETURNVERBOSE)
 

Output:

1/480*(-tan(1/2*x)/(tan(1/2*x)^2-1))^(1/2)/tan(1/2*x)^2*(-380*(tan(1/2*x)* 
(tan(1/2*x)^2-1))^(1/2)*(1+tan(1/2*x))^(1/2)*(-tan(1/2*x))^(1/2)*(-2*tan(1 
/2*x)+2)^(1/2)*EllipticF((1+tan(1/2*x))^(1/2),1/2*2^(1/2))*tan(1/2*x)+240* 
(tan(1/2*x)*(tan(1/2*x)^2-1))^(1/2)*(1+tan(1/2*x))^(1/2)*(-tan(1/2*x))^(1/ 
2)*(-2*tan(1/2*x)+2)^(1/2)*EllipticE((1+tan(1/2*x))^(1/2),1/2*2^(1/2))*tan 
(1/2*x)+2^(1/2)*(tan(1/2*x)*(tan(1/2*x)^2-1))^(1/2)*(tan(1/2*x)^3-tan(1/2* 
x))^(1/2)*sum((22*_alpha^3+39*_alpha^2+22*_alpha+17)*(_alpha^3+2*_alpha-3) 
*(1+tan(1/2*x))^(1/2)*(1-tan(1/2*x))^(1/2)*(-tan(1/2*x))^(1/2)*EllipticPi( 
(1+tan(1/2*x))^(1/2),-1/4*_alpha^3-1/2*_alpha+3/4,1/2*2^(1/2))/(tan(1/2*x) 
*(tan(1/2*x)^2-1))^(1/2),_alpha=RootOf(_Z^4+_Z^3+2*_Z^2-_Z+1))*tan(1/2*x)+ 
40*(tan(1/2*x)*(tan(1/2*x)^2-1))^(1/2)*tan(1/2*x)^4+120*tan(1/2*x)^3*(tan( 
1/2*x)^3-tan(1/2*x))^(1/2)-120*(tan(1/2*x)^3-tan(1/2*x))^(1/2)*tan(1/2*x)- 
40*(tan(1/2*x)*(tan(1/2*x)^2-1))^(1/2))/(tan(1/2*x)^3-tan(1/2*x))^(1/2)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 120 vs. \(2 (50) = 100\).

Time = 0.09 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.74 \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=-\frac {4 \, \sqrt {2} \sqrt {\cos \left (x\right ) \sin \left (x\right )} {\left (2 \, \cos \left (x\right ) + 3 \, \sin \left (x\right )\right )} - 4 \, \cos \left (x\right )^{2} - 15 \, {\left (\cos \left (x\right )^{2} - 1\right )} \log \left (-\frac {1}{2} \, \sqrt {2} \sqrt {\cos \left (x\right ) \sin \left (x\right )} {\left (4 \, \cos \left (x\right ) + 3 \, \sin \left (x\right )\right )} + \frac {1}{2} \, \cos \left (x\right )^{2} + \frac {7}{2} \, \cos \left (x\right ) \sin \left (x\right ) + \frac {1}{2}\right ) + 15 \, {\left (\cos \left (x\right )^{2} - 1\right )} \log \left (\frac {1}{2} \, \cos \left (x\right )^{2} + \frac {1}{2} \, \sqrt {2} \sqrt {\cos \left (x\right ) \sin \left (x\right )} \sin \left (x\right ) - \frac {1}{2} \, \cos \left (x\right ) \sin \left (x\right ) + \frac {1}{2}\right ) + 4}{48 \, {\left (\cos \left (x\right )^{2} - 1\right )}} \] Input:

integrate(csc(x)^2*sec(x)/sin(2*x)^(1/2)/(-2+tan(x)),x, algorithm="fricas" 
)
 

Output:

-1/48*(4*sqrt(2)*sqrt(cos(x)*sin(x))*(2*cos(x) + 3*sin(x)) - 4*cos(x)^2 - 
15*(cos(x)^2 - 1)*log(-1/2*sqrt(2)*sqrt(cos(x)*sin(x))*(4*cos(x) + 3*sin(x 
)) + 1/2*cos(x)^2 + 7/2*cos(x)*sin(x) + 1/2) + 15*(cos(x)^2 - 1)*log(1/2*c 
os(x)^2 + 1/2*sqrt(2)*sqrt(cos(x)*sin(x))*sin(x) - 1/2*cos(x)*sin(x) + 1/2 
) + 4)/(cos(x)^2 - 1)
 

Sympy [F(-1)]

Timed out. \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\text {Timed out} \] Input:

integrate(csc(x)**2*sec(x)/sin(2*x)**(1/2)/(-2+tan(x)),x)
 

Output:

Timed out
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\text {Exception raised: RuntimeError} \] Input:

integrate(csc(x)^2*sec(x)/sin(2*x)^(1/2)/(-2+tan(x)),x, algorithm="maxima" 
)
 

Output:

Exception raised: RuntimeError >> ECL says: THROW: The catch RAT-ERR is un 
defined.
 

Giac [F]

\[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\int { \frac {\csc \left (x\right )^{2} \sec \left (x\right )}{{\left (\tan \left (x\right ) - 2\right )} \sqrt {\sin \left (2 \, x\right )}} \,d x } \] Input:

integrate(csc(x)^2*sec(x)/sin(2*x)^(1/2)/(-2+tan(x)),x, algorithm="giac")
 

Output:

integrate(csc(x)^2*sec(x)/((tan(x) - 2)*sqrt(sin(2*x))), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\int \frac {1}{\sqrt {\sin \left (2\,x\right )}\,\cos \left (x\right )\,{\sin \left (x\right )}^2\,\left (\mathrm {tan}\left (x\right )-2\right )} \,d x \] Input:

int(1/(sin(2*x)^(1/2)*cos(x)*sin(x)^2*(tan(x) - 2)),x)
                                                                                    
                                                                                    
 

Output:

int(1/(sin(2*x)^(1/2)*cos(x)*sin(x)^2*(tan(x) - 2)), x)
 

Reduce [F]

\[ \int \frac {\csc ^2(x) \sec (x)}{\sqrt {\sin (2 x)} (-2+\tan (x))} \, dx=\int \frac {\sqrt {\sin \left (2 x \right )}\, \csc \left (x \right )^{2} \sec \left (x \right )}{\sin \left (2 x \right ) \tan \left (x \right )-2 \sin \left (2 x \right )}d x \] Input:

int(csc(x)^2*sec(x)/sin(2*x)^(1/2)/(-2+tan(x)),x)
 

Output:

int((sqrt(sin(2*x))*csc(x)**2*sec(x))/(sin(2*x)*tan(x) - 2*sin(2*x)),x)