### 3.113 $$\int \csc (2 x) (\cos (x)+\sin (x)) \, dx$$

Optimal. Leaf size=15 $\frac{1}{2} \tanh ^{-1}(\sin (x))-\frac{1}{2} \tanh ^{-1}(\cos (x))$

[Out]

-ArcTanh[Cos[x]]/2 + ArcTanh[Sin[x]]/2

________________________________________________________________________________________

Rubi [A]  time = 0.05349, antiderivative size = 15, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 4, integrand size = 10, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.4, Rules used = {4401, 4287, 3770, 4288} $\frac{1}{2} \tanh ^{-1}(\sin (x))-\frac{1}{2} \tanh ^{-1}(\cos (x))$

Antiderivative was successfully veriﬁed.

[In]

Int[Csc[2*x]*(Cos[x] + Sin[x]),x]

[Out]

-ArcTanh[Cos[x]]/2 + ArcTanh[Sin[x]]/2

Rule 4401

Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /;  !InertTrigFreeQ[u]

Rule 4287

Int[(cos[(a_.) + (b_.)*(x_)]*(e_.))^(m_.)*sin[(c_.) + (d_.)*(x_)]^(p_.), x_Symbol] :> Dist[2^p/e^p, Int[(e*Cos
[a + b*x])^(m + p)*Sin[a + b*x]^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && EqQ[b*c - a*d, 0] && EqQ[d/b, 2]
&& IntegerQ[p]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4288

Int[((f_.)*sin[(a_.) + (b_.)*(x_)])^(n_.)*sin[(c_.) + (d_.)*(x_)]^(p_.), x_Symbol] :> Dist[2^p/f^p, Int[Cos[a
+ b*x]^p*(f*Sin[a + b*x])^(n + p), x], x] /; FreeQ[{a, b, c, d, f, n}, x] && EqQ[b*c - a*d, 0] && EqQ[d/b, 2]
&& IntegerQ[p]

Rubi steps

\begin{align*} \int \csc (2 x) (\cos (x)+\sin (x)) \, dx &=\int (\cos (x) \csc (2 x)+\csc (2 x) \sin (x)) \, dx\\ &=\int \cos (x) \csc (2 x) \, dx+\int \csc (2 x) \sin (x) \, dx\\ &=\frac{1}{2} \int \csc (x) \, dx+\frac{1}{2} \int \sec (x) \, dx\\ &=-\frac{1}{2} \tanh ^{-1}(\cos (x))+\frac{1}{2} \tanh ^{-1}(\sin (x))\\ \end{align*}

Mathematica [B]  time = 0.0093158, size = 61, normalized size = 4.07 $\frac{1}{2} \log \left (\sin \left (\frac{x}{2}\right )\right )-\frac{1}{2} \log \left (\cos \left (\frac{x}{2}\right )\right )-\frac{1}{2} \log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )+\frac{1}{2} \log \left (\sin \left (\frac{x}{2}\right )+\cos \left (\frac{x}{2}\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Csc[2*x]*(Cos[x] + Sin[x]),x]

[Out]

-Log[Cos[x/2]]/2 - Log[Cos[x/2] - Sin[x/2]]/2 + Log[Sin[x/2]]/2 + Log[Cos[x/2] + Sin[x/2]]/2

________________________________________________________________________________________

Maple [A]  time = 0.049, size = 20, normalized size = 1.3 \begin{align*}{\frac{\ln \left ( \sec \left ( x \right ) +\tan \left ( x \right ) \right ) }{2}}+{\frac{\ln \left ( \csc \left ( x \right ) -\cot \left ( x \right ) \right ) }{2}} \end{align*}

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

[In]

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

[Out]

1/2*ln(sec(x)+tan(x))+1/2*ln(csc(x)-cot(x))

________________________________________________________________________________________

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

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

[In]

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

[Out]

-1/4*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) + 1/4*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) + 1/4*log(cos(x)^2
+ sin(x)^2 + 2*sin(x) + 1) - 1/4*log(cos(x)^2 + sin(x)^2 - 2*sin(x) + 1)

________________________________________________________________________________________

Fricas [B]  time = 2.09555, size = 149, normalized size = 9.93 \begin{align*} -\frac{1}{4} \, \log \left (-\frac{1}{2} \,{\left (\cos \left (x\right ) + 1\right )} \sin \left (x\right ) + \frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) + \frac{1}{4} \, \log \left (-\frac{1}{2} \,{\left (\cos \left (x\right ) - 1\right )} \sin \left (x\right ) - \frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) \end{align*}

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

[In]

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

[Out]

-1/4*log(-1/2*(cos(x) + 1)*sin(x) + 1/2*cos(x) + 1/2) + 1/4*log(-1/2*(cos(x) - 1)*sin(x) - 1/2*cos(x) + 1/2)

________________________________________________________________________________________

Sympy [B]  time = 1.05127, size = 32, normalized size = 2.13 \begin{align*} - \frac{\log{\left (\sin{\left (x \right )} - 1 \right )}}{4} + \frac{\log{\left (\sin{\left (x \right )} + 1 \right )}}{4} + \frac{\log{\left (\cos{\left (x \right )} - 1 \right )}}{4} - \frac{\log{\left (\cos{\left (x \right )} + 1 \right )}}{4} \end{align*}

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

[In]

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

[Out]

-log(sin(x) - 1)/4 + log(sin(x) + 1)/4 + log(cos(x) - 1)/4 - log(cos(x) + 1)/4

________________________________________________________________________________________

Giac [B]  time = 1.10121, size = 39, normalized size = 2.6 \begin{align*} \frac{1}{2} \, \log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) + 1 \right |}\right ) - \frac{1}{2} \, \log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) - 1 \right |}\right ) + \frac{1}{2} \, \log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) \right |}\right ) \end{align*}

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

[In]

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

[Out]

1/2*log(abs(tan(1/2*x) + 1)) - 1/2*log(abs(tan(1/2*x) - 1)) + 1/2*log(abs(tan(1/2*x)))