3.1.5 \(\int \frac {\cos ^2(x)}{\sqrt {1+\cos ^2(x)+\cos ^4(x)}} \, dx\) [5]

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

[Out]

1/3*x+1/3*arctan(cos(x)*(1+cos(x)^2)*sin(x)/(1+cos(x)^2*(1+cos(x)^2+cos(x)^4)^(1/2)))

________________________________________________________________________________________

Rubi [C] Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.
time = 0.31, 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 = {6851, 1230, 1117, 1720} \begin {gather*} \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 )}} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Int[Cos[x]^2/Sqrt[1 + Cos[x]^2 + Cos[x]^4],x]

[Out]

(ArcTan[Tan[x]/Sqrt[3 + 3*Tan[x]^2 + Tan[x]^4]]*Cos[x]^2*Sqrt[3 + 3*Tan[x]^2 + Tan[x]^4])/(2*Sqrt[Cos[x]^4*(3
+ 3*Tan[x]^2 + Tan[x]^4)]) - ((1 + Sqrt[3])*Cos[x]^2*EllipticF[2*ArcTan[Tan[x]/3^(1/4)], (2 - Sqrt[3])/4]*(Sqr
t[3] + Tan[x]^2)*Sqrt[(3 + 3*Tan[x]^2 + Tan[x]^4)/(Sqrt[3] + Tan[x]^2)^2])/(4*3^(1/4)*Sqrt[Cos[x]^4*(3 + 3*Tan
[x]^2 + Tan[x]^4)]) + ((2 + Sqrt[3])*Cos[x]^2*EllipticPi[(3 - 2*Sqrt[3])/6, 2*ArcTan[Tan[x]/3^(1/4)], (2 - Sqr
t[3])/4]*(Sqrt[3] + Tan[x]^2)*Sqrt[(3 + 3*Tan[x]^2 + Tan[x]^4)/(Sqrt[3] + Tan[x]^2)^2])/(4*3^(1/4)*Sqrt[Cos[x]
^4*(3 + 3*Tan[x]^2 + Tan[x]^4)])

Rule 1117

Int[1/Sqrt[(a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4], x_Symbol] :> With[{q = Rt[c/a, 4]}, Simp[(1 + q^2*x^2)*(Sqrt[(
a + b*x^2 + c*x^4)/(a*(1 + q^2*x^2)^2)]/(2*q*Sqrt[a + b*x^2 + c*x^4]))*EllipticF[2*ArcTan[q*x], 1/2 - b*(q^2/(
4*c))], x]] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0] && PosQ[c/a]

Rule 1230

Int[1/(((d_) + (e_.)*(x_)^2)*Sqrt[(a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4]), x_Symbol] :> With[{q = Rt[c/a, 2]}, Di
st[(c*d + a*e*q)/(c*d^2 - a*e^2), Int[1/Sqrt[a + b*x^2 + c*x^4], x], x] - Dist[(a*e*(e + d*q))/(c*d^2 - a*e^2)
, Int[(1 + q*x^2)/((d + e*x^2)*Sqrt[a + b*x^2 + c*x^4]), 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[c*d^2 - a*e^2, 0] && PosQ[c/a]

Rule 1720

Int[((A_) + (B_.)*(x_)^2)/(((d_) + (e_.)*(x_)^2)*Sqrt[(a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4]), x_Symbol] :> With[
{q = Rt[B/A, 2]}, Simp[(-(B*d - A*e))*(ArcTan[Rt[-b + c*(d/e) + a*(e/d), 2]*(x/Sqrt[a + b*x^2 + c*x^4])]/(2*d*
e*Rt[-b + c*(d/e) + a*(e/d), 2])), x] + Simp[(B*d + A*e)*(A + B*x^2)*(Sqrt[A^2*((a + b*x^2 + c*x^4)/(a*(A + B*
x^2)^2))]/(4*d*e*A*q*Sqrt[a + b*x^2 + c*x^4]))*EllipticPi[Cancel[-(B*d - A*e)^2/(4*d*e*A*B)], 2*ArcTan[q*x], 1
/2 - b*(A/(4*a*B))], x]] /; FreeQ[{a, b, c, d, e, A, B}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^
2, 0] && NeQ[c*d^2 - a*e^2, 0] && PosQ[c/a] && EqQ[c*A^2 - a*B^2, 0]

Rule 6851

Int[(u_.)*((a_.)*(v_)^(m_.)*(w_)^(n_.))^(p_), x_Symbol] :> Dist[a^IntPart[p]*((a*v^m*w^n)^FracPart[p]/(v^(m*Fr
acPart[p])*w^(n*FracPart[p]))), Int[u*v^(m*p)*w^(n*p), x], x] /; FreeQ[{a, m, n, p}, x] &&  !IntegerQ[p] &&  !
FreeQ[v, x] &&  !FreeQ[w, x]

Rubi steps

\begin {align*} \int \frac {\cos ^2(x)}{\sqrt {1+\cos ^2(x)+\cos ^4(x)}} \, dx &=\text {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 ) \text {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 ) \text {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 ) \text {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] Result contains complex when optimal does not.
time = 26.76, size = 98, normalized size = 2.18 \begin {gather*} -\frac {i \sqrt {2} \cos ^2(x) \log \left (\frac {i-\tan (x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}}{i+\tan (x) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}}\right ) \sqrt {3+3 \tan ^2(x)+\tan ^4(x)}}{3 \sqrt {15+8 \cos (2 x)+\cos (4 x)}} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]^2/Sqrt[1 + Cos[x]^2 + Cos[x]^4],x]

[Out]

((-1/3*I)*Sqrt[2]*Cos[x]^2*Log[(I - Tan[x]*Sqrt[3 + 3*Tan[x]^2 + Tan[x]^4])/(I + Tan[x]*Sqrt[3 + 3*Tan[x]^2 +
Tan[x]^4])]*Sqrt[3 + 3*Tan[x]^2 + Tan[x]^4])/Sqrt[15 + 8*Cos[2*x] + Cos[4*x]]

________________________________________________________________________________________

Mathics [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: SystemError} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

mathics('Integrate[Cos[x]^2/Sqrt[Cos[x]^4 + Cos[x]^2 + 1],x]')

[Out]

Exception raised: SystemError >> excessive stack use: stack is 3062 deep

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.40, size = 312, normalized size = 6.93

method result size
default \(-\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 {i \sqrt {3}-\cos \left (2 x \right )-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 (i \sqrt {3}-\cos \left (2 x \right )-2\right )}\, \sin \left (2 x \right ) \sqrt {\cos ^{2}\left (2 x \right )+4 \cos \left (2 x \right )+7}}\) \(312\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^2/(1+cos(x)^2+cos(x)^4)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-2*((cos(2*x)^2+4*cos(2*x)+7)*sin(2*x)^2)^(1/2)*(I*3^(1/2)-3)*((-1+I*3^(1/2))*(cos(2*x)-1)/(I*3^(1/2)-3)/(cos(
2*x)+1))^(1/2)*(cos(2*x)+1)^2*((cos(2*x)+2+I*3^(1/2))/(I*3^(1/2)+3)/(cos(2*x)+1))^(1/2)*((I*3^(1/2)-cos(2*x)-2
)/(I*3^(1/2)-3)/(cos(2*x)+1))^(1/2)*EllipticPi(((-1+I*3^(1/2))*(cos(2*x)-1)/(I*3^(1/2)-3)/(cos(2*x)+1))^(1/2),
(I*3^(1/2)-3)/(-1+I*3^(1/2)),((1+I*3^(1/2))*(I*3^(1/2)-3)/(I*3^(1/2)+3)/(-1+I*3^(1/2)))^(1/2))/(-1+I*3^(1/2))/
((cos(2*x)-1)*(cos(2*x)+1)*(cos(2*x)+2+I*3^(1/2))*(I*3^(1/2)-cos(2*x)-2))^(1/2)/sin(2*x)/(cos(2*x)^2+4*cos(2*x
)+7)^(1/2)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(1+cos(x)^2+cos(x)^4)^(1/2),x, algorithm="maxima")

[Out]

integrate(cos(x)^2/sqrt(cos(x)^4 + cos(x)^2 + 1), x)

________________________________________________________________________________________

Fricas [A]
time = 0.40, size = 33, normalized size = 0.73 \begin {gather*} \frac {1}{6} \, \arctan \left (\frac {2 \, \sqrt {\cos \left (x\right )^{4} + \cos \left (x\right )^{2} + 1} \cos \left (x\right )^{3} \sin \left (x\right )}{2 \, \cos \left (x\right )^{6} - 1}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(1+cos(x)^2+cos(x)^4)^(1/2),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: SystemError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)**2/(1+cos(x)**2+cos(x)**4)**(1/2),x)

[Out]

Exception raised: SystemError

________________________________________________________________________________________

Giac [F] N/A
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(1+cos(x)^2+cos(x)^4)^(1/2),x)

[Out]

Could not integrate

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {{\cos \left (x\right )}^2}{\sqrt {{\cos \left (x\right )}^4+{\cos \left (x\right )}^2+1}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^2/(cos(x)^2 + cos(x)^4 + 1)^(1/2),x)

[Out]

int(cos(x)^2/(cos(x)^2 + cos(x)^4 + 1)^(1/2), x)

________________________________________________________________________________________