3.373 \(\int \frac{\cot (x)}{2+\sin (2 x)} \, dx\)

Optimal. Leaf size=64 \[ -\frac{x}{2 \sqrt{3}}+\frac{1}{2} \log (\sin (x))+\frac{\tan ^{-1}\left (\frac{1-2 \cos ^2(x)}{2 \sin (x) \cos (x)+\sqrt{3}+2}\right )}{2 \sqrt{3}}-\frac{1}{4} \log (\sin (x) \cos (x)+1) \]

[Out]

-x/(2*Sqrt[3]) + ArcTan[(1 - 2*Cos[x]^2)/(2 + Sqrt[3] + 2*Cos[x]*Sin[x])]/(2*Sqrt[3]) + Log[Sin[x]]/2 - Log[1
+ Cos[x]*Sin[x]]/4

________________________________________________________________________________________

Rubi [A]  time = 0.0784877, antiderivative size = 65, normalized size of antiderivative = 1.02, number of steps used = 7, number of rules used = 6, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.546, Rules used = {705, 29, 634, 618, 204, 628} \[ -\frac{x}{2 \sqrt{3}}-\frac{1}{4} \log \left (\tan ^2(x)+\tan (x)+1\right )+\frac{1}{2} \log (\tan (x))+\frac{\tan ^{-1}\left (\frac{1-2 \cos ^2(x)}{2 \sin (x) \cos (x)+\sqrt{3}+2}\right )}{2 \sqrt{3}} \]

Antiderivative was successfully verified.

[In]

Int[Cot[x]/(2 + Sin[2*x]),x]

[Out]

-x/(2*Sqrt[3]) + ArcTan[(1 - 2*Cos[x]^2)/(2 + Sqrt[3] + 2*Cos[x]*Sin[x])]/(2*Sqrt[3]) + Log[Tan[x]]/2 - Log[1
+ Tan[x] + Tan[x]^2]/4

Rule 705

Int[1/(((d_.) + (e_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)), x_Symbol] :> Dist[e^2/(c*d^2 - b*d*e + a*e^2
), Int[1/(d + e*x), x], x] + Dist[1/(c*d^2 - b*d*e + a*e^2), Int[(c*d - b*e - c*e*x)/(a + b*x + c*x^2), x], x]
 /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && NeQ[2*c*d - b*e, 0]

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

\begin{align*} \int \frac{\cot (x)}{2+\sin (2 x)} \, dx &=\operatorname{Subst}\left (\int \frac{1}{x \left (2+2 x+2 x^2\right )} \, dx,x,\tan (x)\right )\\ &=\frac{1}{2} \operatorname{Subst}\left (\int \frac{1}{x} \, dx,x,\tan (x)\right )+\frac{1}{2} \operatorname{Subst}\left (\int \frac{-2-2 x}{2+2 x+2 x^2} \, dx,x,\tan (x)\right )\\ &=\frac{1}{2} \log (\tan (x))-\frac{1}{4} \operatorname{Subst}\left (\int \frac{2+4 x}{2+2 x+2 x^2} \, dx,x,\tan (x)\right )-\frac{1}{2} \operatorname{Subst}\left (\int \frac{1}{2+2 x+2 x^2} \, dx,x,\tan (x)\right )\\ &=\frac{1}{2} \log (\tan (x))-\frac{1}{4} \log \left (1+\tan (x)+\tan ^2(x)\right )+\operatorname{Subst}\left (\int \frac{1}{-12-x^2} \, dx,x,2+4 \tan (x)\right )\\ &=-\frac{x}{2 \sqrt{3}}+\frac{\tan ^{-1}\left (\frac{1-2 \cos ^2(x)}{2+\sqrt{3}+2 \cos (x) \sin (x)}\right )}{2 \sqrt{3}}+\frac{1}{2} \log (\tan (x))-\frac{1}{4} \log \left (1+\tan (x)+\tan ^2(x)\right )\\ \end{align*}

Mathematica [A]  time = 0.0362993, size = 39, normalized size = 0.61 \[ \frac{1}{12} \left (-2 \sqrt{3} \tan ^{-1}\left (\frac{2 \tan (x)+1}{\sqrt{3}}\right )+6 \log (\sin (x))-3 \log (\sin (2 x)+2)\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[x]/(2 + Sin[2*x]),x]

[Out]

(-2*Sqrt[3]*ArcTan[(1 + 2*Tan[x])/Sqrt[3]] + 6*Log[Sin[x]] - 3*Log[2 + Sin[2*x]])/12

________________________________________________________________________________________

Maple [A]  time = 0.062, size = 35, normalized size = 0.6 \begin{align*}{\frac{\ln \left ( \tan \left ( x \right ) \right ) }{2}}-{\frac{\ln \left ( 1+\tan \left ( x \right ) + \left ( \tan \left ( x \right ) \right ) ^{2} \right ) }{4}}-{\frac{\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 2\,\tan \left ( x \right ) +1 \right ) \sqrt{3}}{3}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/sin(x)/(2+sin(2*x)),x)

[Out]

1/2*ln(tan(x))-1/4*ln(1+tan(x)+tan(x)^2)-1/6*3^(1/2)*arctan(1/3*(2*tan(x)+1)*3^(1/2))

________________________________________________________________________________________

Maxima [B]  time = 1.50802, size = 281, normalized size = 4.39 \begin{align*} -\frac{1}{24} \, \sqrt{3}{\left (\sqrt{3} \log \left (-2 \,{\left (4 \, \sin \left (2 \, x\right ) + 1\right )} \cos \left (4 \, x\right ) + \cos \left (4 \, x\right )^{2} + 16 \, \cos \left (2 \, x\right )^{2} + 8 \, \cos \left (2 \, x\right ) \sin \left (4 \, x\right ) + \sin \left (4 \, x\right )^{2} + 16 \, \sin \left (2 \, x\right )^{2} + 8 \, \sin \left (2 \, x\right ) + 1\right ) - 2 \, \sqrt{3} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right ) - 2 \, \sqrt{3} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1\right ) - 2 \, \arctan \left (\frac{2 \, \sqrt{3} \cos \left (2 \, x\right )}{\cos \left (2 \, x\right )^{2} - 2 \,{\left (\sqrt{3} - 2\right )} \sin \left (2 \, x\right ) + \sin \left (2 \, x\right )^{2} - 4 \, \sqrt{3} + 7}, \frac{\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 4 \, \sin \left (2 \, x\right ) + 1}{\cos \left (2 \, x\right )^{2} - 2 \,{\left (\sqrt{3} - 2\right )} \sin \left (2 \, x\right ) + \sin \left (2 \, x\right )^{2} - 4 \, \sqrt{3} + 7}\right )\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/(2+sin(2*x)),x, algorithm="maxima")

[Out]

-1/24*sqrt(3)*(sqrt(3)*log(-2*(4*sin(2*x) + 1)*cos(4*x) + cos(4*x)^2 + 16*cos(2*x)^2 + 8*cos(2*x)*sin(4*x) + s
in(4*x)^2 + 16*sin(2*x)^2 + 8*sin(2*x) + 1) - 2*sqrt(3)*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - 2*sqrt(3)*lo
g(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) - 2*arctan2(2*sqrt(3)*cos(2*x)/(cos(2*x)^2 - 2*(sqrt(3) - 2)*sin(2*x) +
sin(2*x)^2 - 4*sqrt(3) + 7), (cos(2*x)^2 + sin(2*x)^2 + 4*sin(2*x) + 1)/(cos(2*x)^2 - 2*(sqrt(3) - 2)*sin(2*x)
 + sin(2*x)^2 - 4*sqrt(3) + 7)))

________________________________________________________________________________________

Fricas [A]  time = 2.46668, size = 223, normalized size = 3.48 \begin{align*} -\frac{1}{12} \, \sqrt{3} \arctan \left (\frac{4 \, \sqrt{3} \cos \left (x\right ) \sin \left (x\right ) + \sqrt{3}}{3 \,{\left (2 \, \cos \left (x\right )^{2} - 1\right )}}\right ) - \frac{1}{8} \, \log \left (-\cos \left (x\right )^{4} + \cos \left (x\right )^{2} + 2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) + \frac{1}{4} \, \log \left (-\frac{1}{4} \, \cos \left (x\right )^{2} + \frac{1}{4}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/(2+sin(2*x)),x, algorithm="fricas")

[Out]

-1/12*sqrt(3)*arctan(1/3*(4*sqrt(3)*cos(x)*sin(x) + sqrt(3))/(2*cos(x)^2 - 1)) - 1/8*log(-cos(x)^4 + cos(x)^2
+ 2*cos(x)*sin(x) + 1) + 1/4*log(-1/4*cos(x)^2 + 1/4)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\cos{\left (x \right )}}{\left (\sin{\left (2 x \right )} + 2\right ) \sin{\left (x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/(2+sin(2*x)),x)

[Out]

Integral(cos(x)/((sin(2*x) + 2)*sin(x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.14812, size = 101, normalized size = 1.58 \begin{align*} -\frac{1}{6} \, \sqrt{3}{\left (x + \arctan \left (-\frac{\sqrt{3} \sin \left (2 \, x\right ) - \cos \left (2 \, x\right ) - 2 \, \sin \left (2 \, x\right ) - 1}{\sqrt{3} \cos \left (2 \, x\right ) + \sqrt{3} - 2 \, \cos \left (2 \, x\right ) + \sin \left (2 \, x\right ) + 2}\right )\right )} - \frac{1}{4} \, \log \left (\tan \left (x\right )^{2} + \tan \left (x\right ) + 1\right ) + \frac{1}{2} \, \log \left ({\left | \tan \left (x\right ) \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/(2+sin(2*x)),x, algorithm="giac")

[Out]

-1/6*sqrt(3)*(x + arctan(-(sqrt(3)*sin(2*x) - cos(2*x) - 2*sin(2*x) - 1)/(sqrt(3)*cos(2*x) + sqrt(3) - 2*cos(2
*x) + sin(2*x) + 2))) - 1/4*log(tan(x)^2 + tan(x) + 1) + 1/2*log(abs(tan(x)))