3.4.76 \(\int \frac {1}{4+\sqrt {3} \cos (x)+\sin (x)} \, dx\) [376]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.07, 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 = {3203, 631, 210} \begin {gather*} \frac {\text {ArcTan}\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 (\left (3-4 \sqrt {3}\right ) \cos (x)\right )+2 \left (5+2 \sqrt {3}\right )}\right )}{\sqrt {3}}+\frac {x}{2 \sqrt {3}} \end {gather*}

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

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 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}{4+\sqrt {3} \cos (x)+\sin (x)} \, dx &=2 \text {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 \text {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.05, size = 33, normalized size = 0.62 \begin {gather*} -\frac {\tan ^{-1}\left (\frac {-1+\left (-4+\sqrt {3}\right ) \tan \left (\frac {x}{2}\right )}{2 \sqrt {3}}\right )}{\sqrt {3}} \end {gather*}

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.11, size = 43, normalized size = 0.81

method result size
default \(-\frac {52 \arctan \left (\frac {26 \tan \left (\frac {x}{2}\right )+2 \sqrt {3}+8}{16 \sqrt {3}+12}\right )}{\left (\sqrt {3}-4\right ) \left (16 \sqrt {3}+12\right )}\) \(43\)
risch \(-\frac {i \sqrt {3}\, \ln \left (-\frac {i \sqrt {3}}{2}+\sqrt {3}-\frac {3}{2}+i+{\mathrm e}^{i x}\right )}{6}+\frac {i \sqrt {3}\, \ln \left ({\mathrm e}^{i x}+\sqrt {3}+\frac {3}{2}+i+\frac {i \sqrt {3}}{2}\right )}{6}\) \(52\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[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 = 2.68, size = 27, normalized size = 0.51 \begin {gather*} -\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 {gather*}

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 = 1.46, size = 38, normalized size = 0.72 \begin {gather*} \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 {gather*}

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] Leaf count of result is larger than twice the leaf count of optimal. 107 vs. \(2 (48) = 96\).
time = 6.29, size = 107, normalized size = 2.02 \begin {gather*} - \frac {71049062919648516608727362362371223166654224256969 \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 )}{-213147188758945549826182087087113669499962672770907 + 123060586806989187969890042718152127140914603059700 \sqrt {3}} + \frac {123060586806989187969890042718152127140914603059700 \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 )}{-213147188758945549826182087087113669499962672770907 + 123060586806989187969890042718152127140914603059700 \sqrt {3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-71049062919648516608727362362371223166654224256969*sqrt(3)*(atan(-tan(x/2)/2 + 2*sqrt(3)*tan(x/2)/3 + sqrt(3)
/6) + pi*floor((x/2 - pi/2)/pi))/(-213147188758945549826182087087113669499962672770907 + 123060586806989187969
890042718152127140914603059700*sqrt(3)) + 123060586806989187969890042718152127140914603059700*(atan(-tan(x/2)/
2 + 2*sqrt(3)*tan(x/2)/3 + sqrt(3)/6) + pi*floor((x/2 - pi/2)/pi))/(-21314718875894554982618208708711366949996
2672770907 + 123060586806989187969890042718152127140914603059700*sqrt(3))

________________________________________________________________________________________

Giac [A]
time = 0.63, size = 78, normalized size = 1.47 \begin {gather*} \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 {gather*}

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)

________________________________________________________________________________________

Mupad [B]
time = 0.21, size = 23, normalized size = 0.43 \begin {gather*} -\frac {\sqrt {12}\,\mathrm {atan}\left (\frac {\sqrt {12}\,\left (\mathrm {tan}\left (\frac {x}{2}\right )\,\left (\sqrt {3}-4\right )-1\right )}{12}\right )}{6} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(12^(1/2)*atan((12^(1/2)*(tan(x/2)*(3^(1/2) - 4) - 1))/12))/6

________________________________________________________________________________________