### 3.248 $$\int \frac{1}{2 \sin (x)+\sin (2 x)} \, dx$$

Optimal. Leaf size=24 $\frac{1}{8} \tan ^2\left (\frac{x}{2}\right )+\frac{1}{4} \log \left (\tan \left (\frac{x}{2}\right )\right )$

[Out]

Log[Tan[x/2]]/4 + Tan[x/2]^2/8

________________________________________________________________________________________

Rubi [A]  time = 0.0268354, antiderivative size = 24, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 2, integrand size = 11, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.182, Rules used = {12, 14} $\frac{1}{8} \tan ^2\left (\frac{x}{2}\right )+\frac{1}{4} \log \left (\tan \left (\frac{x}{2}\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

Log[Tan[x/2]]/4 + Tan[x/2]^2/8

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
&&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rubi steps

\begin{align*} \int \frac{1}{2 \sin (x)+\sin (2 x)} \, dx &=2 \operatorname{Subst}\left (\int \frac{1+x^2}{8 x} \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=\frac{1}{4} \operatorname{Subst}\left (\int \frac{1+x^2}{x} \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=\frac{1}{4} \operatorname{Subst}\left (\int \left (\frac{1}{x}+x\right ) \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=\frac{1}{4} \log \left (\tan \left (\frac{x}{2}\right )\right )+\frac{1}{8} \tan ^2\left (\frac{x}{2}\right )\\ \end{align*}

Mathematica [A]  time = 0.0286321, size = 39, normalized size = 1.62 $\frac{1-2 \cos ^2\left (\frac{x}{2}\right ) \left (\log \left (\cos \left (\frac{x}{2}\right )\right )-\log \left (\sin \left (\frac{x}{2}\right )\right )\right )}{4 (\cos (x)+1)}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(1 - 2*Cos[x/2]^2*(Log[Cos[x/2]] - Log[Sin[x/2]]))/(4*(1 + Cos[x]))

________________________________________________________________________________________

Maple [A]  time = 0.052, size = 24, normalized size = 1. \begin{align*}{\frac{1}{4\,\cos \left ( x \right ) +4}}-{\frac{\ln \left ( \cos \left ( x \right ) +1 \right ) }{8}}+{\frac{\ln \left ( \cos \left ( x \right ) -1 \right ) }{8}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int(1/(2*sin(x)+sin(2*x)),x)

[Out]

1/4/(cos(x)+1)-1/8*ln(cos(x)+1)+1/8*ln(cos(x)-1)

________________________________________________________________________________________

Maxima [B]  time = 0.963876, size = 297, normalized size = 12.38 \begin{align*} \frac{4 \, \cos \left (2 \, x\right ) \cos \left (x\right ) + 8 \, \cos \left (x\right )^{2} -{\left (2 \,{\left (2 \, \cos \left (x\right ) + 1\right )} \cos \left (2 \, x\right ) + \cos \left (2 \, x\right )^{2} + 4 \, \cos \left (x\right )^{2} + \sin \left (2 \, x\right )^{2} + 4 \, \sin \left (2 \, x\right ) \sin \left (x\right ) + 4 \, \sin \left (x\right )^{2} + 4 \, \cos \left (x\right ) + 1\right )} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right ) +{\left (2 \,{\left (2 \, \cos \left (x\right ) + 1\right )} \cos \left (2 \, x\right ) + \cos \left (2 \, x\right )^{2} + 4 \, \cos \left (x\right )^{2} + \sin \left (2 \, x\right )^{2} + 4 \, \sin \left (2 \, x\right ) \sin \left (x\right ) + 4 \, \sin \left (x\right )^{2} + 4 \, \cos \left (x\right ) + 1\right )} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1\right ) + 4 \, \sin \left (2 \, x\right ) \sin \left (x\right ) + 8 \, \sin \left (x\right )^{2} + 4 \, \cos \left (x\right )}{8 \,{\left (2 \,{\left (2 \, \cos \left (x\right ) + 1\right )} \cos \left (2 \, x\right ) + \cos \left (2 \, x\right )^{2} + 4 \, \cos \left (x\right )^{2} + \sin \left (2 \, x\right )^{2} + 4 \, \sin \left (2 \, x\right ) \sin \left (x\right ) + 4 \, \sin \left (x\right )^{2} + 4 \, \cos \left (x\right ) + 1\right )}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/8*(4*cos(2*x)*cos(x) + 8*cos(x)^2 - (2*(2*cos(x) + 1)*cos(2*x) + cos(2*x)^2 + 4*cos(x)^2 + sin(2*x)^2 + 4*si
n(2*x)*sin(x) + 4*sin(x)^2 + 4*cos(x) + 1)*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) + (2*(2*cos(x) + 1)*cos(2*x
) + cos(2*x)^2 + 4*cos(x)^2 + sin(2*x)^2 + 4*sin(2*x)*sin(x) + 4*sin(x)^2 + 4*cos(x) + 1)*log(cos(x)^2 + sin(x
)^2 - 2*cos(x) + 1) + 4*sin(2*x)*sin(x) + 8*sin(x)^2 + 4*cos(x))/(2*(2*cos(x) + 1)*cos(2*x) + cos(2*x)^2 + 4*c
os(x)^2 + sin(2*x)^2 + 4*sin(2*x)*sin(x) + 4*sin(x)^2 + 4*cos(x) + 1)

________________________________________________________________________________________

Fricas [B]  time = 2.34319, size = 132, normalized size = 5.5 \begin{align*} -\frac{{\left (\cos \left (x\right ) + 1\right )} \log \left (\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) -{\left (\cos \left (x\right ) + 1\right )} \log \left (-\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) - 2}{8 \,{\left (\cos \left (x\right ) + 1\right )}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/8*((cos(x) + 1)*log(1/2*cos(x) + 1/2) - (cos(x) + 1)*log(-1/2*cos(x) + 1/2) - 2)/(cos(x) + 1)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{1}{2 \sin{\left (x \right )} + \sin{\left (2 x \right )}}\, dx \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(2*sin(x)+sin(2*x)),x)

[Out]

Integral(1/(2*sin(x) + sin(2*x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.06128, size = 38, normalized size = 1.58 \begin{align*} -\frac{\cos \left (x\right ) - 1}{8 \,{\left (\cos \left (x\right ) + 1\right )}} + \frac{1}{8} \, \log \left (-\frac{\cos \left (x\right ) - 1}{\cos \left (x\right ) + 1}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/8*(cos(x) - 1)/(cos(x) + 1) + 1/8*log(-(cos(x) - 1)/(cos(x) + 1))