3.376 \(\int \frac{1}{4+\sqrt{3} \cos (x)+\sin (x)} \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0981272, antiderivative size = 83, normalized size of antiderivative = 1.57, number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {3124, 617, 204} \[ \frac{x}{2 \sqrt{3}}+\frac{\tan ^{-1}\left (\frac{\left (3-4 \sqrt{3}\right ) \sin (x)+\left (4-\sqrt{3}\right ) \cos (x)}{\left (4-\sqrt{3}\right ) \sin (x)-\left (3-4 \sqrt{3}\right ) \cos (x)+2 \left (5+2 \sqrt{3}\right )}\right )}{\sqrt{3}} \]

Antiderivative was successfully verified.

[In]

Int[(4 + Sqrt[3]*Cos[x] + Sin[x])^(-1),x]

[Out]

x/(2*Sqrt[3]) + ArcTan[((4 - Sqrt[3])*Cos[x] + (3 - 4*Sqrt[3])*Sin[x])/(2*(5 + 2*Sqrt[3]) - (3 - 4*Sqrt[3])*Co
s[x] + (4 - Sqrt[3])*Sin[x])]/Sqrt[3]

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 617

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[(a*c)/b^2]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + (2*c*x)/b], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 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}{4+\sqrt{3} \cos (x)+\sin (x)} \, dx &=2 \operatorname{Subst}\left (\int \frac{1}{4+\sqrt{3}+2 x+\left (4-\sqrt{3}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=-\left (2 \operatorname{Subst}\left (\int \frac{1}{-12-x^2} \, dx,x,1+\left (4-\sqrt{3}\right ) \tan \left (\frac{x}{2}\right )\right )\right )\\ &=\frac{x}{2 \sqrt{3}}+\frac{\tan ^{-1}\left (\frac{\left (4-\sqrt{3}\right ) \cos (x)+\left (3-4 \sqrt{3}\right ) \sin (x)}{2 \left (5+2 \sqrt{3}\right )-\left (3-4 \sqrt{3}\right ) \cos (x)+\left (4-\sqrt{3}\right ) \sin (x)}\right )}{\sqrt{3}}\\ \end{align*}

Mathematica [A]  time = 0.0586049, size = 33, normalized size = 0.62 \[ -\frac{\tan ^{-1}\left (\frac{\left (\sqrt{3}-4\right ) \tan \left (\frac{x}{2}\right )-1}{2 \sqrt{3}}\right )}{\sqrt{3}} \]

Antiderivative was successfully verified.

[In]

Integrate[(4 + Sqrt[3]*Cos[x] + Sin[x])^(-1),x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.046, size = 43, normalized size = 0.8 \begin{align*} -52\,{\frac{1}{ \left ( \sqrt{3}-4 \right ) \left ( 16\,\sqrt{3}+12 \right ) }\arctan \left ({\frac{26\,\tan \left ( x/2 \right ) +2\,\sqrt{3}+8}{16\,\sqrt{3}+12}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(4+sin(x)+cos(x)*3^(1/2)),x)

[Out]

-52/(3^(1/2)-4)/(16*3^(1/2)+12)*arctan((26*tan(1/2*x)+2*3^(1/2)+8)/(16*3^(1/2)+12))

________________________________________________________________________________________

Maxima [A]  time = 1.41039, size = 36, normalized size = 0.68 \begin{align*} -\frac{1}{3} \, \sqrt{3} \arctan \left (\frac{1}{6} \, \sqrt{3}{\left (\frac{{\left (\sqrt{3} - 4\right )} \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/(4+sin(x)+cos(x)*3^(1/2)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.36854, size = 128, normalized size = 2.42 \begin{align*} \frac{1}{6} \, \sqrt{3} \arctan \left (\frac{2 \,{\left ({\left (4 \, \sqrt{3} \cos \left (x\right ) + 3\right )} \sin \left (x\right ) + \sqrt{3} \cos \left (x\right ) + 3\right )}}{3 \,{\left (4 \, \cos \left (x\right )^{2} - 3\right )}}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(4+sin(x)+cos(x)*3^(1/2)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 8.79338, size = 107, normalized size = 2.02 \begin{align*} - \frac{32740422521042607546022212148053452119318508626030927624231148228935405286489175211319301372839079350465571750721183129 \sqrt{3} \left (\operatorname{atan}{\left (- \frac{\tan{\left (\frac{x}{2} \right )}}{2} + \frac{2 \sqrt{3} \tan{\left (\frac{x}{2} \right )}}{3} + \frac{\sqrt{3}}{6} \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{-98221267563127822638066636444160356357955525878092782872693444686806215859467525633957904118517238051396715252163549387 + 56708075267718105834187832387484068077733602149839287127746937933009385700734375614806821267782634833770441526627045716 \sqrt{3}} + \frac{56708075267718105834187832387484068077733602149839287127746937933009385700734375614806821267782634833770441526627045716 \left (\operatorname{atan}{\left (- \frac{\tan{\left (\frac{x}{2} \right )}}{2} + \frac{2 \sqrt{3} \tan{\left (\frac{x}{2} \right )}}{3} + \frac{\sqrt{3}}{6} \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{-98221267563127822638066636444160356357955525878092782872693444686806215859467525633957904118517238051396715252163549387 + 56708075267718105834187832387484068077733602149839287127746937933009385700734375614806821267782634833770441526627045716 \sqrt{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(4+sin(x)+cos(x)*3**(1/2)),x)

[Out]

-3274042252104260754602221214805345211931850862603092762423114822893540528648917521131930137283907935046557175
0721183129*sqrt(3)*(atan(-tan(x/2)/2 + 2*sqrt(3)*tan(x/2)/3 + sqrt(3)/6) + pi*floor((x/2 - pi/2)/pi))/(-982212
67563127822638066636444160356357955525878092782872693444686806215859467525633957904118517238051396715252163549
387 + 56708075267718105834187832387484068077733602149839287127746937933009385700734375614806821267782634833770
441526627045716*sqrt(3)) + 56708075267718105834187832387484068077733602149839287127746937933009385700734375614
806821267782634833770441526627045716*(atan(-tan(x/2)/2 + 2*sqrt(3)*tan(x/2)/3 + sqrt(3)/6) + pi*floor((x/2 - p
i/2)/pi))/(-98221267563127822638066636444160356357955525878092782872693444686806215859467525633957904118517238
051396715252163549387 + 56708075267718105834187832387484068077733602149839287127746937933009385700734375614806
821267782634833770441526627045716*sqrt(3))

________________________________________________________________________________________

Giac [A]  time = 1.06747, size = 105, normalized size = 1.98 \begin{align*} \frac{{\left (x + 2 \, \arctan \left (\frac{\sqrt{3} \cos \left (x\right ) - 8 \, \sqrt{3} \sin \left (x\right ) + \sqrt{3} + 4 \, \cos \left (x\right ) + 7 \, \sin \left (x\right ) + 4}{8 \, \sqrt{3} \cos \left (x\right ) + \sqrt{3} \sin \left (x\right ) + 8 \, \sqrt{3} - 7 \, \cos \left (x\right ) + 4 \, \sin \left (x\right ) + 19}\right )\right )}{\left (\sqrt{3} + 4\right )}}{2 \,{\left (4 \, \sqrt{3} + 3\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(4+sin(x)+cos(x)*3^(1/2)),x, algorithm="giac")

[Out]

1/2*(x + 2*arctan((sqrt(3)*cos(x) - 8*sqrt(3)*sin(x) + sqrt(3) + 4*cos(x) + 7*sin(x) + 4)/(8*sqrt(3)*cos(x) +
sqrt(3)*sin(x) + 8*sqrt(3) - 7*cos(x) + 4*sin(x) + 19)))*(sqrt(3) + 4)/(4*sqrt(3) + 3)