Optimal. Leaf size=45 \[ \frac {x}{3}+\frac {1}{3} \tan ^{-1}\left (\frac {\sin (x) \cos (x) \left (\cos ^2(x)+1\right )}{\sqrt {\cos ^4(x)+\cos ^2(x)+1} \cos ^2(x)+1}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [C] time = 0.49, antiderivative size = 289, normalized size of antiderivative = 6.42, number of steps used = 5, number of rules used = 4, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.210, Rules used = {6719, 1216, 1103, 1706} \[ \frac {\cos ^2(x) \tan ^{-1}\left (\frac {\tan (x)}{\sqrt {\tan ^4(x)+3 \tan ^2(x)+3}}\right ) \sqrt {\tan ^4(x)+3 \tan ^2(x)+3}}{2 \sqrt {\cos ^4(x) \left (\tan ^4(x)+3 \tan ^2(x)+3\right )}}-\frac {\left (1+\sqrt {3}\right ) \cos ^2(x) \left (\tan ^2(x)+\sqrt {3}\right ) \sqrt {\frac {\tan ^4(x)+3 \tan ^2(x)+3}{\left (\tan ^2(x)+\sqrt {3}\right )^2}} F\left (2 \tan ^{-1}\left (\frac {\tan (x)}{\sqrt [4]{3}}\right )|\frac {1}{4} \left (2-\sqrt {3}\right )\right )}{4 \sqrt [4]{3} \sqrt {\cos ^4(x) \left (\tan ^4(x)+3 \tan ^2(x)+3\right )}}+\frac {\left (2+\sqrt {3}\right ) \cos ^2(x) \left (\tan ^2(x)+\sqrt {3}\right ) \sqrt {\frac {\tan ^4(x)+3 \tan ^2(x)+3}{\left (\tan ^2(x)+\sqrt {3}\right )^2}} \Pi \left (\frac {1}{6} \left (3-2 \sqrt {3}\right );2 \tan ^{-1}\left (\frac {\tan (x)}{\sqrt [4]{3}}\right )|\frac {1}{4} \left (2-\sqrt {3}\right )\right )}{4 \sqrt [4]{3} \sqrt {\cos ^4(x) \left (\tan ^4(x)+3 \tan ^2(x)+3\right )}} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
Rule 1103
Rule 1216
Rule 1706
Rule 6719
Rubi steps
\begin {align*} \int \frac {\cos ^2(x)}{\sqrt {1+\cos ^2(x)+\cos ^4(x)}} \, dx &=\operatorname {Subst}\left (\int \frac {1}{\left (1+x^2\right )^2 \sqrt {\frac {3+3 x^2+x^4}{\left (1+x^2\right )^2}}} \, dx,x,\tan (x)\right )\\ &=\frac {\left (\cos ^2(x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}\right ) \operatorname {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \sqrt {3+3 x^2+x^4}} \, dx,x,\tan (x)\right )}{\sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}\\ &=\frac {\left (\left (-1-\sqrt {3}\right ) \cos ^2(x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {3+3 x^2+x^4}} \, dx,x,\tan (x)\right )}{2 \sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}+\frac {\left (\left (3+\sqrt {3}\right ) \cos ^2(x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}\right ) \operatorname {Subst}\left (\int \frac {1+\frac {x^2}{\sqrt {3}}}{\left (1+x^2\right ) \sqrt {3+3 x^2+x^4}} \, dx,x,\tan (x)\right )}{2 \sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}\\ &=\frac {\tan ^{-1}\left (\frac {\tan (x)}{\sqrt {3+3 \tan ^2(x)+\tan ^4(x)}}\right ) \cos ^2(x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}}{2 \sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}-\frac {\left (1+\sqrt {3}\right ) \cos ^2(x) F\left (2 \tan ^{-1}\left (\frac {\tan (x)}{\sqrt [4]{3}}\right )|\frac {1}{4} \left (2-\sqrt {3}\right )\right ) \left (\sqrt {3}+\tan ^2(x)\right ) \sqrt {\frac {3+3 \tan ^2(x)+\tan ^4(x)}{\left (\sqrt {3}+\tan ^2(x)\right )^2}}}{4 \sqrt [4]{3} \sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}+\frac {\left (2+\sqrt {3}\right ) \cos ^2(x) \Pi \left (\frac {1}{6} \left (3-2 \sqrt {3}\right );2 \tan ^{-1}\left (\frac {\tan (x)}{\sqrt [4]{3}}\right )|\frac {1}{4} \left (2-\sqrt {3}\right )\right ) \left (\sqrt {3}+\tan ^2(x)\right ) \sqrt {\frac {3+3 \tan ^2(x)+\tan ^4(x)}{\left (\sqrt {3}+\tan ^2(x)\right )^2}}}{4 \sqrt [4]{3} \sqrt {\cos ^4(x) \left (3+3 \tan ^2(x)+\tan ^4(x)\right )}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 2.21, size = 159, normalized size = 3.53 \[ -\frac {2 i \cos ^2(x) \sqrt {1-\frac {2 i \tan ^2(x)}{\sqrt {3}-3 i}} \sqrt {1+\frac {2 i \tan ^2(x)}{\sqrt {3}+3 i}} \Pi \left (\frac {3}{2}+\frac {i \sqrt {3}}{2};i \sinh ^{-1}\left (\sqrt {-\frac {2 i}{-3 i+\sqrt {3}}} \tan (x)\right )|\frac {3 i-\sqrt {3}}{3 i+\sqrt {3}}\right )}{\sqrt {-\frac {i}{\sqrt {3}-3 i}} \sqrt {8 \cos (2 x)+\cos (4 x)+15}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.54, size = 33, normalized size = 0.73 \[ \frac {1}{6} \, \arctan \left (\frac {2 \, \sqrt {\cos \relax (x)^{4} + \cos \relax (x)^{2} + 1} \cos \relax (x)^{3} \sin \relax (x)}{2 \, \cos \relax (x)^{6} - 1}\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cos \relax (x)^{2}}{\sqrt {\cos \relax (x)^{4} + \cos \relax (x)^{2} + 1}}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [C] time = 0.60, size = 312, normalized size = 6.93 \[ -\frac {2 \sqrt {\left (\cos ^{2}\left (2 x \right )+4 \cos \left (2 x \right )+7\right ) \left (\sin ^{2}\left (2 x \right )\right )}\, \left (i \sqrt {3}-3\right ) \sqrt {\frac {\left (-1+i \sqrt {3}\right ) \left (\cos \left (2 x \right )-1\right )}{\left (i \sqrt {3}-3\right ) \left (\cos \left (2 x \right )+1\right )}}\, \left (\cos \left (2 x \right )+1\right )^{2} \sqrt {\frac {\cos \left (2 x \right )+2+i \sqrt {3}}{\left (i \sqrt {3}+3\right ) \left (\cos \left (2 x \right )+1\right )}}\, \sqrt {\frac {-\cos \left (2 x \right )+i \sqrt {3}-2}{\left (i \sqrt {3}-3\right ) \left (\cos \left (2 x \right )+1\right )}}\, \EllipticPi \left (\sqrt {\frac {\left (-1+i \sqrt {3}\right ) \left (\cos \left (2 x \right )-1\right )}{\left (i \sqrt {3}-3\right ) \left (\cos \left (2 x \right )+1\right )}}, \frac {i \sqrt {3}-3}{-1+i \sqrt {3}}, \sqrt {\frac {\left (1+i \sqrt {3}\right ) \left (i \sqrt {3}-3\right )}{\left (i \sqrt {3}+3\right ) \left (-1+i \sqrt {3}\right )}}\right )}{\left (-1+i \sqrt {3}\right ) \sqrt {\left (\cos \left (2 x \right )-1\right ) \left (\cos \left (2 x \right )+1\right ) \left (\cos \left (2 x \right )+2+i \sqrt {3}\right ) \left (-\cos \left (2 x \right )+i \sqrt {3}-2\right )}\, \sqrt {\cos ^{2}\left (2 x \right )+4 \cos \left (2 x \right )+7}\, \sin \left (2 x \right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cos \relax (x)^{2}}{\sqrt {\cos \relax (x)^{4} + \cos \relax (x)^{2} + 1}}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.02 \[ \int \frac {{\cos \relax (x)}^2}{\sqrt {{\cos \relax (x)}^4+{\cos \relax (x)}^2+1}} \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________