\(\int \csc (2 x) (\cos (x)+\sin (x)) \, dx\) [113]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 15 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=-\frac {1}{2} \text {arctanh}(\cos (x))+\frac {1}{2} \text {arctanh}(\sin (x)) \]

[Out]

-1/2*arctanh(cos(x))+1/2*arctanh(sin(x))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4486, 4372, 3855, 4373} \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=\frac {1}{2} \text {arctanh}(\sin (x))-\frac {1}{2} \text {arctanh}(\cos (x)) \]

[In]

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

[Out]

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

Rule 3855

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

Rule 4372

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 4373

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]

Rule 4486

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

Rubi steps \begin{align*} \text {integral}& = \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} \text {arctanh}(\cos (x))+\frac {1}{2} \text {arctanh}(\sin (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 30, normalized size of antiderivative = 2.00 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=\frac {1}{2} \text {arctanh}(\sin (x))-\frac {1}{2} \log \left (\cos \left (\frac {x}{2}\right )\right )+\frac {1}{2} \log \left (\sin \left (\frac {x}{2}\right )\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.57 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.20

method result size
parts \(-\frac {\ln \left (\csc \left (x \right )+\cot \left (x \right )\right )}{2}+\frac {\ln \left (\sec \left (x \right )+\tan \left (x \right )\right )}{2}\) \(18\)
default \(\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}\) \(20\)
risch \(\frac {\ln \left ({\mathrm e}^{2 i x}+\left (-1+i\right ) {\mathrm e}^{i x}-i\right )}{2}-\frac {\ln \left ({\mathrm e}^{2 i x}+\left (1-i\right ) {\mathrm e}^{i x}-i\right )}{2}\) \(42\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 35 vs. \(2 (11) = 22\).

Time = 0.26 (sec) , antiderivative size = 35, normalized size of antiderivative = 2.33 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=-\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 ) \]

[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] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (12) = 24\).

Time = 0.52 (sec) , antiderivative size = 32, normalized size of antiderivative = 2.13 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=- \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} \]

[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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 69 vs. \(2 (11) = 22\).

Time = 0.28 (sec) , antiderivative size = 69, normalized size of antiderivative = 4.60 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=-\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 ) \]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 29 vs. \(2 (11) = 22\).

Time = 0.32 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.93 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=\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 ) \]

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

Mupad [B] (verification not implemented)

Time = 0.49 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.60 \[ \int \csc (2 x) (\cos (x)+\sin (x)) \, dx=\frac {\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+\mathrm {tan}\left (\frac {x}{2}\right )\right )}{2}-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-1\right )}{2} \]

[In]

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

[Out]

log(tan(x/2) + tan(x/2)^2)/2 - log(tan(x/2) - 1)/2