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]

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

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, 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 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])

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 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]

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.03, 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]

________________________________________________________________________________________

fricas [A]  time = 0.42, size = 36, normalized size = 0.80 \[ \frac {1}{10} \, \sqrt {5} \arctan \left (-\frac {\sqrt {5} \cos \relax (x) - 2 \, \sqrt {5} \sin \relax (x) - \sqrt {5}}{2 \, {\left (2 \, \cos \relax (x) + \sin \relax (x)\right )}}\right ) \]

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)))

________________________________________________________________________________________

giac [A]  time = 0.01, size = 47, normalized size = 1.04 \[ \frac {1}{10} \, \sqrt {5} {\left (x + 2 \, \arctan \left (-\frac {\sqrt {5} \sin \relax (x) - \cos \relax (x) - 3 \, \sin \relax (x) - 1}{\sqrt {5} \cos \relax (x) + \sqrt {5} - 3 \, \cos \relax (x) + \sin \relax (x) + 3}\right )\right )} \]

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)))

________________________________________________________________________________________

maple [A]  time = 0.06, size = 20, normalized size = 0.44 \[ \frac {\sqrt {5}\, \arctan \left (\frac {\left (6 \tan \left (\frac {x}{2}\right )+2\right ) \sqrt {5}}{10}\right )}{5} \]

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.27, size = 23, normalized size = 0.51 \[ \frac {1}{5} \, \sqrt {5} \arctan \left (\frac {1}{5} \, \sqrt {5} {\left (\frac {3 \, \sin \relax (x)}{\cos \relax (x) + 1} + 1\right )}\right ) \]

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))

________________________________________________________________________________________

mupad [B]  time = 0.10, size = 21, normalized size = 0.47 \[ \frac {\sqrt {20}\,\mathrm {atan}\left (\frac {3\,\sqrt {20}\,\mathrm {tan}\left (\frac {x}{2}\right )}{10}+\frac {\sqrt {20}}{10}\right )}{10} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.49, size = 39, normalized size = 0.87 \[ \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} \]

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

________________________________________________________________________________________