3.2.17 \(\int \frac {1}{2+\cos (x)} \, dx\) [117]

Optimal. Leaf size=20 \[ \frac {2 \arctan \left (\frac {\tan \left (\frac {x}{2}\right )}{\sqrt {3}}\right )}{\sqrt {3}} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 30, normalized size of antiderivative = 1.50, number of steps used = 1, number of rules used = 1, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {2736} \begin {gather*} \frac {x}{\sqrt {3}}-\frac {2 \arctan \left (\frac {\sin (x)}{\cos (x)+\sqrt {3}+2}\right )}{\sqrt {3}} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 2736

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{q = Rt[a^2 - b^2, 2]}, Simp[x/q, x] + Simp
[(2/(d*q))*ArcTan[b*(Cos[c + d*x]/(a + q + b*Sin[c + d*x]))], x]] /; FreeQ[{a, b, c, d}, x] && GtQ[a^2 - b^2,
0] && PosQ[a]

Rubi steps

\begin {gather*} \begin {aligned} \text {Integral} &=\frac {x}{\sqrt {3}}-\frac {2 \arctan \left (\frac {\sin (x)}{2+\sqrt {3}+\cos (x)}\right )}{\sqrt {3}}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 20, normalized size = 1.00 \begin {gather*} \frac {2 \arctan \left (\frac {\tan \left (\frac {x}{2}\right )}{\sqrt {3}}\right )}{\sqrt {3}} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 16, normalized size = 0.80

method result size
default \(\frac {2 \arctan \left (\frac {\tan \left (\frac {x}{2}\right ) \sqrt {3}}{3}\right ) \sqrt {3}}{3}\) \(16\)
risch \(\frac {i \sqrt {3}\, \ln \left ({\mathrm e}^{i x}+2+\sqrt {3}\right )}{3}-\frac {i \sqrt {3}\, \ln \left ({\mathrm e}^{i x}+2-\sqrt {3}\right )}{3}\) \(38\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.48, size = 19, normalized size = 0.95 \begin {gather*} \frac {2}{3} \, \sqrt {3} \arctan \left (\frac {\sqrt {3} \sin \left (x\right )}{3 \, {\left (\cos \left (x\right ) + 1\right )}}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.59, size = 23, normalized size = 1.15 \begin {gather*} -\frac {1}{3} \, \sqrt {3} \arctan \left (\frac {2 \, \sqrt {3} \cos \left (x\right ) + \sqrt {3}}{3 \, \sin \left (x\right )}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.25, size = 32, normalized size = 1.60 \begin {gather*} \frac {2 \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 )}{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 40 vs. \(2 (15) = 30\).
time = 0.49, size = 40, normalized size = 2.00 \begin {gather*} \frac {1}{3} \, \sqrt {3} {\left (x + 2 \, \arctan \left (-\frac {\sqrt {3} \sin \left (x\right ) - \sin \left (x\right )}{\sqrt {3} \cos \left (x\right ) + \sqrt {3} - \cos \left (x\right ) + 1}\right )\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.20, size = 32, normalized size = 1.60 \begin {gather*} \frac {2\,\sqrt {3}\,\left (\frac {x}{2}-\mathrm {atan}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right )\right )}{3}+\frac {2\,\sqrt {3}\,\mathrm {atan}\left (\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )}{3}\right )}{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Chatgpt [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {not solved} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

not solved

________________________________________________________________________________________