\(\int \frac {1}{4-\cos ^2(x)} \, dx\) [18]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 41 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {x}{2 \sqrt {3}}+\frac {\arctan \left (\frac {\cos (x) \sin (x)}{3+2 \sqrt {3}+\sin ^2(x)}\right )}{2 \sqrt {3}} \]

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3260, 209} \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {\arctan \left (\frac {\sin (x) \cos (x)}{\sin ^2(x)+2 \sqrt {3}+3}\right )}{2 \sqrt {3}}+\frac {x}{2 \sqrt {3}} \]

[In]

Int[(4 - Cos[x]^2)^(-1),x]

[Out]

x/(2*Sqrt[3]) + ArcTan[(Cos[x]*Sin[x])/(3 + 2*Sqrt[3] + Sin[x]^2)]/(2*Sqrt[3])

Rule 209

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

Rule 3260

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{4+3 x^2} \, dx,x,\cot (x)\right ) \\ & = \frac {x}{2 \sqrt {3}}+\frac {\arctan \left (\frac {\cos (x) \sin (x)}{3+2 \sqrt {3}+\sin ^2(x)}\right )}{2 \sqrt {3}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.46 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {\arctan \left (\frac {2 \tan (x)}{\sqrt {3}}\right )}{2 \sqrt {3}} \]

[In]

Integrate[(4 - Cos[x]^2)^(-1),x]

[Out]

ArcTan[(2*Tan[x])/Sqrt[3]]/(2*Sqrt[3])

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.34

method result size
default \(\frac {\sqrt {3}\, \arctan \left (\frac {2 \tan \left (x \right ) \sqrt {3}}{3}\right )}{6}\) \(14\)
risch \(\frac {i \sqrt {3}\, \ln \left ({\mathrm e}^{2 i x}-4 \sqrt {3}-7\right )}{12}-\frac {i \sqrt {3}\, \ln \left ({\mathrm e}^{2 i x}+4 \sqrt {3}-7\right )}{12}\) \(40\)

[In]

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

[Out]

1/6*3^(1/2)*arctan(2/3*tan(x)*3^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.76 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=-\frac {1}{12} \, \sqrt {3} \arctan \left (\frac {7 \, \sqrt {3} \cos \left (x\right )^{2} - 4 \, \sqrt {3}}{12 \, \cos \left (x\right ) \sin \left (x\right )}\right ) \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.49 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {\sqrt {3} \left (\operatorname {atan}{\left (\frac {\sqrt {3} \tan {\left (\frac {x}{2} \right )}}{3} \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{6} + \frac {\sqrt {3} \left (\operatorname {atan}{\left (\sqrt {3} \tan {\left (\frac {x}{2} \right )} \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{6} \]

[In]

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

[Out]

sqrt(3)*(atan(sqrt(3)*tan(x/2)/3) + pi*floor((x/2 - pi/2)/pi))/6 + sqrt(3)*(atan(sqrt(3)*tan(x/2)) + pi*floor(
(x/2 - pi/2)/pi))/6

Maxima [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.32 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {1}{6} \, \sqrt {3} \arctan \left (\frac {2}{3} \, \sqrt {3} \tan \left (x\right )\right ) \]

[In]

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

[Out]

1/6*sqrt(3)*arctan(2/3*sqrt(3)*tan(x))

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.12 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {1}{6} \, \sqrt {3} {\left (x + \arctan \left (-\frac {\sqrt {3} \sin \left (2 \, x\right ) - 2 \, \sin \left (2 \, x\right )}{\sqrt {3} \cos \left (2 \, x\right ) + \sqrt {3} - 2 \, \cos \left (2 \, x\right ) + 2}\right )\right )} \]

[In]

integrate(1/(4-cos(x)^2),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.63 \[ \int \frac {1}{4-\cos ^2(x)} \, dx=\frac {\sqrt {3}\,\left (x-\mathrm {atan}\left (\mathrm {tan}\left (x\right )\right )\right )}{6}+\frac {\sqrt {3}\,\mathrm {atan}\left (\frac {2\,\sqrt {3}\,\mathrm {tan}\left (x\right )}{3}\right )}{6} \]

[In]

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

[Out]

(3^(1/2)*(x - atan(tan(x))))/6 + (3^(1/2)*atan((2*3^(1/2)*tan(x))/3))/6