Optimal. Leaf size=64 \[ -\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 (\sin (x))-\frac {1}{4} \log (1+\cos (x) \sin (x)) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, 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 = {719, 29, 648,
632, 210, 642} \begin {gather*} \frac {\text {ArcTan}\left (\frac {1-2 \cos ^2(x)}{2 \sin (x) \cos (x)+\sqrt {3}+2}\right )}{2 \sqrt {3}}-\frac {x}{2 \sqrt {3}}-\frac {1}{4} \log \left (\tan ^2(x)+\tan (x)+1\right )+\frac {1}{2} \log (\tan (x)) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 29
Rule 210
Rule 632
Rule 642
Rule 648
Rule 719
Rubi steps
\begin {align*} \int \frac {\cot (x)}{2+\sin (2 x)} \, dx &=\text {Subst}\left (\int \frac {1}{x \left (2+2 x+2 x^2\right )} \, dx,x,\tan (x)\right )\\ &=\frac {1}{2} \text {Subst}\left (\int \frac {1}{x} \, dx,x,\tan (x)\right )+\frac {1}{2} \text {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} \text {Subst}\left (\int \frac {2+4 x}{2+2 x+2 x^2} \, dx,x,\tan (x)\right )-\frac {1}{2} \text {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 )+\text {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.04, size = 39, normalized size = 0.61 \begin {gather*} \frac {1}{12} \left (-2 \sqrt {3} \tan ^{-1}\left (\frac {1+2 \tan (x)}{\sqrt {3}}\right )+6 \log (\sin (x))-3 \log (2+\sin (2 x))\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.15, size = 35, normalized size = 0.55
method | result | size |
default | \(-\frac {\ln \left (1+\tan \left (x \right )+\tan ^{2}\left (x \right )\right )}{4}-\frac {\sqrt {3}\, \arctan \left (\frac {\left (2 \tan \left (x \right )+1\right ) \sqrt {3}}{3}\right )}{6}+\frac {\ln \left (\tan \left (x \right )\right )}{2}\) | \(35\) |
risch | \(\frac {\ln \left ({\mathrm e}^{2 i x}-1\right )}{2}-\frac {\ln \left ({\mathrm e}^{2 i x}-i \sqrt {3}+2 i\right )}{4}+\frac {i \ln \left ({\mathrm e}^{2 i x}-i \sqrt {3}+2 i\right ) \sqrt {3}}{12}-\frac {\ln \left ({\mathrm e}^{2 i x}+i \sqrt {3}+2 i\right )}{4}-\frac {i \ln \left ({\mathrm e}^{2 i x}+i \sqrt {3}+2 i\right ) \sqrt {3}}{12}\) | \(88\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 208 vs.
\(2 (51) = 102\).
time = 2.46, size = 208, normalized size = 3.25 \begin {gather*} -\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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.06, size = 64, normalized size = 1.00 \begin {gather*} -\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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cos {\left (x \right )}}{\left (\sin {\left (2 x \right )} + 2\right ) \sin {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.73, size = 75, normalized size = 1.17 \begin {gather*} -\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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.34, size = 47, normalized size = 0.73 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (x\right )\right )}{2}+\ln \left (\mathrm {tan}\left (x\right )+\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (-\frac {1}{4}+\frac {\sqrt {3}\,1{}\mathrm {i}}{12}\right )-\ln \left (\mathrm {tan}\left (x\right )+\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {1}{4}+\frac {\sqrt {3}\,1{}\mathrm {i}}{12}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________