3.140 \(\int \frac{1}{5-\cos (x)+2 \sin (x)} \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0242, antiderivative size = 45, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25, Rules used = {3124, 618, 204} \[ \frac{x}{2 \sqrt{5}}+\frac{\tan ^{-1}\left (\frac{\sin (x)+2 \cos (x)}{2 \sin (x)-\cos (x)+2 \sqrt{5}+5}\right )}{\sqrt{5}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 3124

Int[(cos[(d_.) + (e_.)*(x_)]*(b_.) + (a_) + (c_.)*sin[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Module[{f = Free
Factors[Tan[(d + e*x)/2], x]}, Dist[(2*f)/e, Subst[Int[1/(a + b + 2*c*f*x + (a - b)*f^2*x^2), x], x, Tan[(d +
e*x)/2]/f], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[a^2 - b^2 - c^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rubi steps

\begin{align*} \int \frac{1}{5-\cos (x)+2 \sin (x)} \, dx &=2 \operatorname{Subst}\left (\int \frac{1}{4+4 x+6 x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=-\left (4 \operatorname{Subst}\left (\int \frac{1}{-80-x^2} \, dx,x,4+12 \tan \left (\frac{x}{2}\right )\right )\right )\\ &=\frac{x}{2 \sqrt{5}}+\frac{\tan ^{-1}\left (\frac{2 \cos (x)+\sin (x)}{5+2 \sqrt{5}-\cos (x)+2 \sin (x)}\right )}{\sqrt{5}}\\ \end{align*}

Mathematica [A]  time = 0.0238248, size = 23, normalized size = 0.51 \[ \frac{\tan ^{-1}\left (\frac{3 \tan \left (\frac{x}{2}\right )+1}{\sqrt{5}}\right )}{\sqrt{5}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.035, size = 20, normalized size = 0.4 \begin{align*}{\frac{\sqrt{5}}{5}\arctan \left ({\frac{\sqrt{5}}{10} \left ( 6\,\tan \left ( x/2 \right ) +2 \right ) } \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(5-cos(x)+2*sin(x)),x)

[Out]

1/5*5^(1/2)*arctan(1/10*(6*tan(1/2*x)+2)*5^(1/2))

________________________________________________________________________________________

Maxima [A]  time = 1.41722, size = 31, normalized size = 0.69 \begin{align*} \frac{1}{5} \, \sqrt{5} \arctan \left (\frac{1}{5} \, \sqrt{5}{\left (\frac{3 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right )}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(5-cos(x)+2*sin(x)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.10643, size = 126, normalized size = 2.8 \begin{align*} \frac{1}{10} \, \sqrt{5} \arctan \left (-\frac{\sqrt{5} \cos \left (x\right ) - 2 \, \sqrt{5} \sin \left (x\right ) - \sqrt{5}}{2 \,{\left (2 \, \cos \left (x\right ) + \sin \left (x\right )\right )}}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(5-cos(x)+2*sin(x)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.494684, size = 39, normalized size = 0.87 \begin{align*} \frac{\sqrt{5} \left (\operatorname{atan}{\left (\frac{3 \sqrt{5} \tan{\left (\frac{x}{2} \right )}}{5} + \frac{\sqrt{5}}{5} \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{5} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(5-cos(x)+2*sin(x)),x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.09243, size = 63, normalized size = 1.4 \begin{align*} \frac{1}{10} \, \sqrt{5}{\left (x + 2 \, \arctan \left (-\frac{\sqrt{5} \sin \left (x\right ) - \cos \left (x\right ) - 3 \, \sin \left (x\right ) - 1}{\sqrt{5} \cos \left (x\right ) + \sqrt{5} - 3 \, \cos \left (x\right ) + \sin \left (x\right ) + 3}\right )\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(5-cos(x)+2*sin(x)),x, algorithm="giac")

[Out]

1/10*sqrt(5)*(x + 2*arctan(-(sqrt(5)*sin(x) - cos(x) - 3*sin(x) - 1)/(sqrt(5)*cos(x) + sqrt(5) - 3*cos(x) + si
n(x) + 3)))