3.142 \(\int \frac{1}{1+2 \cos (x)} \, dx\)

Optimal. Leaf size=56 \[ \frac{\log \left (\sin \left (\frac{x}{2}\right )+\sqrt{3} \cos \left (\frac{x}{2}\right )\right )}{\sqrt{3}}-\frac{\log \left (\sqrt{3} \cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )}{\sqrt{3}} \]

[Out]

-(Log[Sqrt[3]*Cos[x/2] - Sin[x/2]]/Sqrt[3]) + Log[Sqrt[3]*Cos[x/2] + Sin[x/2]]/S
qrt[3]

_______________________________________________________________________________________

Rubi [A]  time = 0.0375471, antiderivative size = 56, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25 \[ \frac{\log \left (\sin \left (\frac{x}{2}\right )+\sqrt{3} \cos \left (\frac{x}{2}\right )\right )}{\sqrt{3}}-\frac{\log \left (\sqrt{3} \cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )}{\sqrt{3}} \]

Antiderivative was successfully verified.

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

[Out]

-(Log[Sqrt[3]*Cos[x/2] - Sin[x/2]]/Sqrt[3]) + Log[Sqrt[3]*Cos[x/2] + Sin[x/2]]/S
qrt[3]

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 0.579725, size = 20, normalized size = 0.36 \[ \frac{2 \sqrt{3} \operatorname{atanh}{\left (\frac{\sqrt{3} \tan{\left (\frac{x}{2} \right )}}{3} \right )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate(1/(1+2*cos(x)),x)

[Out]

2*sqrt(3)*atanh(sqrt(3)*tan(x/2)/3)/3

_______________________________________________________________________________________

Mathematica [A]  time = 0.0129929, size = 20, normalized size = 0.36 \[ \frac{2 \tanh ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right )}{\sqrt{3}}\right )}{\sqrt{3}} \]

Antiderivative was successfully verified.

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

[Out]

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

_______________________________________________________________________________________

Maple [A]  time = 0.013, size = 16, normalized size = 0.3 \[{\frac{2\,\sqrt{3}}{3}{\it Artanh} \left ({\frac{\sqrt{3}}{3}\tan \left ({\frac{x}{2}} \right ) } \right ) } \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int(1/(1+2*cos(x)),x)

[Out]

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

_______________________________________________________________________________________

Maxima [A]  time = 1.48372, size = 50, normalized size = 0.89 \[ -\frac{1}{3} \, \sqrt{3} \log \left (-\frac{\sqrt{3} - \frac{\sin \left (x\right )}{\cos \left (x\right ) + 1}}{\sqrt{3} + \frac{\sin \left (x\right )}{\cos \left (x\right ) + 1}}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(2*cos(x) + 1),x, algorithm="maxima")

[Out]

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

_______________________________________________________________________________________

Fricas [A]  time = 0.22219, size = 70, normalized size = 1.25 \[ \frac{1}{6} \, \sqrt{3} \log \left (-\frac{2 \, \sqrt{3} \cos \left (x\right )^{2} - 6 \,{\left (\cos \left (x\right ) + 2\right )} \sin \left (x\right ) - 4 \, \sqrt{3} \cos \left (x\right ) - 7 \, \sqrt{3}}{4 \, \cos \left (x\right )^{2} + 4 \, \cos \left (x\right ) + 1}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(2*cos(x) + 1),x, algorithm="fricas")

[Out]

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

_______________________________________________________________________________________

Sympy [A]  time = 0.536907, size = 36, normalized size = 0.64 \[ - \frac{\sqrt{3} \log{\left (\tan{\left (\frac{x}{2} \right )} - \sqrt{3} \right )}}{3} + \frac{\sqrt{3} \log{\left (\tan{\left (\frac{x}{2} \right )} + \sqrt{3} \right )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(1+2*cos(x)),x)

[Out]

-sqrt(3)*log(tan(x/2) - sqrt(3))/3 + sqrt(3)*log(tan(x/2) + sqrt(3))/3

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.248927, size = 47, normalized size = 0.84 \[ -\frac{1}{3} \, \sqrt{3}{\rm ln}\left (\frac{{\left | -2 \, \sqrt{3} + 2 \, \tan \left (\frac{1}{2} \, x\right ) \right |}}{{\left | 2 \, \sqrt{3} + 2 \, \tan \left (\frac{1}{2} \, x\right ) \right |}}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(2*cos(x) + 1),x, algorithm="giac")

[Out]

-1/3*sqrt(3)*ln(abs(-2*sqrt(3) + 2*tan(1/2*x))/abs(2*sqrt(3) + 2*tan(1/2*x)))