3.2.40 \(\int \frac {1}{5-\cos (x)+2 \sin (x)} \, dx\) [140]

Optimal. Leaf size=45 \[ \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}} \]

[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.03, 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 = {3203, 632, 210} \begin {gather*} \frac {\text {ArcTan}\left (\frac {\sin (x)+2 \cos (x)}{2 \sin (x)-\cos (x)+2 \sqrt {5}+5}\right )}{\sqrt {5}}+\frac {x}{2 \sqrt {5}} \end {gather*}

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 210

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

Rule 632

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 3203

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 \text {Subst}\left (\int \frac {1}{4+4 x+6 x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )\\ &=-\left (4 \text {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.02, size = 23, normalized size = 0.51 \begin {gather*} \frac {\tan ^{-1}\left (\frac {1+3 \tan \left (\frac {x}{2}\right )}{\sqrt {5}}\right )}{\sqrt {5}} \end {gather*}

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.10, size = 20, normalized size = 0.44

method result size
default \(\frac {\sqrt {5}\, \arctan \left (\frac {\left (6 \tan \left (\frac {x}{2}\right )+2\right ) \sqrt {5}}{10}\right )}{5}\) \(20\)
risch \(\frac {i \sqrt {5}\, \ln \left ({\mathrm e}^{i x}-1+2 i+\frac {4 i \sqrt {5}}{5}-\frac {2 \sqrt {5}}{5}\right )}{10}-\frac {i \sqrt {5}\, \ln \left ({\mathrm e}^{i x}-1+2 i-\frac {4 i \sqrt {5}}{5}+\frac {2 \sqrt {5}}{5}\right )}{10}\) \(56\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.99, size = 23, normalized size = 0.51 \begin {gather*} \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 {gather*}

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 = 0.92, size = 36, normalized size = 0.80 \begin {gather*} \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 {gather*}

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.18, size = 39, normalized size = 0.87 \begin {gather*} \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 {gather*}

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 = 0.44, size = 47, normalized size = 1.04 \begin {gather*} \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 {gather*}

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

________________________________________________________________________________________

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

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

________________________________________________________________________________________