\(\int \cot (4 x) \sin (x) \, dx\) [82]

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

Optimal result

Integrand size = 7, antiderivative size = 28 \[ \int \cot (4 x) \sin (x) \, dx=-\frac {1}{4} \text {arctanh}(\sin (x))-\frac {\text {arctanh}\left (\sqrt {2} \sin (x)\right )}{2 \sqrt {2}}+\sin (x) \]

[Out]

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

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {1690, 1180, 213} \[ \int \cot (4 x) \sin (x) \, dx=-\frac {1}{4} \text {arctanh}(\sin (x))-\frac {\text {arctanh}\left (\sqrt {2} \sin (x)\right )}{2 \sqrt {2}}+\sin (x) \]

[In]

Int[Cot[4*x]*Sin[x],x]

[Out]

-1/4*ArcTanh[Sin[x]] - ArcTanh[Sqrt[2]*Sin[x]]/(2*Sqrt[2]) + Sin[x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 1180

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Di
st[e/2 + (2*c*d - b*e)/(2*q), Int[1/(b/2 - q/2 + c*x^2), x], x] + Dist[e/2 - (2*c*d - b*e)/(2*q), Int[1/(b/2 +
 q/2 + c*x^2), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - a*e^2, 0] && PosQ[b^
2 - 4*a*c]

Rule 1690

Int[(Pq_)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> Int[ExpandIntegrand[Pq/(a + b*x^2 + c*x^4), x], x
] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x^2] && Expon[Pq, x^2] > 1

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1-8 x^2+8 x^4}{4-12 x^2+8 x^4} \, dx,x,\sin (x)\right ) \\ & = \text {Subst}\left (\int \left (1-\frac {3-4 x^2}{4-12 x^2+8 x^4}\right ) \, dx,x,\sin (x)\right ) \\ & = \sin (x)-\text {Subst}\left (\int \frac {3-4 x^2}{4-12 x^2+8 x^4} \, dx,x,\sin (x)\right ) \\ & = \sin (x)+2 \text {Subst}\left (\int \frac {1}{-8+8 x^2} \, dx,x,\sin (x)\right )+2 \text {Subst}\left (\int \frac {1}{-4+8 x^2} \, dx,x,\sin (x)\right ) \\ & = -\frac {1}{4} \text {arctanh}(\sin (x))-\frac {\text {arctanh}\left (\sqrt {2} \sin (x)\right )}{2 \sqrt {2}}+\sin (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00 \[ \int \cot (4 x) \sin (x) \, dx=-\frac {1}{4} \text {arctanh}(\sin (x))-\frac {\text {arctanh}\left (\sqrt {2} \sin (x)\right )}{2 \sqrt {2}}+\sin (x) \]

[In]

Integrate[Cot[4*x]*Sin[x],x]

[Out]

-1/4*ArcTanh[Sin[x]] - ArcTanh[Sqrt[2]*Sin[x]]/(2*Sqrt[2]) + Sin[x]

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 0.38 (sec) , antiderivative size = 88, normalized size of antiderivative = 3.14

method result size
risch \(-\frac {i {\mathrm e}^{i x}}{2}+\frac {i {\mathrm e}^{-i x}}{2}+\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{4}-\frac {\ln \left (i+{\mathrm e}^{i x}\right )}{4}+\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i x}-i \sqrt {2}\, {\mathrm e}^{i x}-1\right )}{8}-\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i x}+i \sqrt {2}\, {\mathrm e}^{i x}-1\right )}{8}\) \(88\)

[In]

int(cot(4*x)*sin(x),x,method=_RETURNVERBOSE)

[Out]

-1/2*I*exp(I*x)+1/2*I*exp(-I*x)+1/4*ln(exp(I*x)-I)-1/4*ln(I+exp(I*x))+1/8*2^(1/2)*ln(exp(2*I*x)-I*2^(1/2)*exp(
I*x)-1)-1/8*2^(1/2)*ln(exp(2*I*x)+I*2^(1/2)*exp(I*x)-1)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 52 vs. \(2 (20) = 40\).

Time = 0.25 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.86 \[ \int \cot (4 x) \sin (x) \, dx=\frac {1}{8} \, \sqrt {2} \log \left (-\frac {2 \, \cos \left (x\right )^{2} + 2 \, \sqrt {2} \sin \left (x\right ) - 3}{2 \, \cos \left (x\right )^{2} - 1}\right ) - \frac {1}{8} \, \log \left (\sin \left (x\right ) + 1\right ) + \frac {1}{8} \, \log \left (-\sin \left (x\right ) + 1\right ) + \sin \left (x\right ) \]

[In]

integrate(cot(4*x)*sin(x),x, algorithm="fricas")

[Out]

1/8*sqrt(2)*log(-(2*cos(x)^2 + 2*sqrt(2)*sin(x) - 3)/(2*cos(x)^2 - 1)) - 1/8*log(sin(x) + 1) + 1/8*log(-sin(x)
 + 1) + sin(x)

Sympy [F]

\[ \int \cot (4 x) \sin (x) \, dx=\int \sin {\left (x \right )} \cot {\left (4 x \right )}\, dx \]

[In]

integrate(cot(4*x)*sin(x),x)

[Out]

Integral(sin(x)*cot(4*x), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 173 vs. \(2 (20) = 40\).

Time = 0.29 (sec) , antiderivative size = 173, normalized size of antiderivative = 6.18 \[ \int \cot (4 x) \sin (x) \, dx=-\frac {1}{16} \, \sqrt {2} \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) + 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) + \frac {1}{16} \, \sqrt {2} \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) - 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) - \frac {1}{16} \, \sqrt {2} \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} - 2 \, \sqrt {2} \cos \left (x\right ) + 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) + \frac {1}{16} \, \sqrt {2} \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} - 2 \, \sqrt {2} \cos \left (x\right ) - 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) - \frac {1}{8} \, \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \sin \left (x\right ) + 1\right ) + \frac {1}{8} \, \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \sin \left (x\right ) + 1\right ) + \sin \left (x\right ) \]

[In]

integrate(cot(4*x)*sin(x),x, algorithm="maxima")

[Out]

-1/16*sqrt(2)*log(2*cos(x)^2 + 2*sin(x)^2 + 2*sqrt(2)*cos(x) + 2*sqrt(2)*sin(x) + 2) + 1/16*sqrt(2)*log(2*cos(
x)^2 + 2*sin(x)^2 + 2*sqrt(2)*cos(x) - 2*sqrt(2)*sin(x) + 2) - 1/16*sqrt(2)*log(2*cos(x)^2 + 2*sin(x)^2 - 2*sq
rt(2)*cos(x) + 2*sqrt(2)*sin(x) + 2) + 1/16*sqrt(2)*log(2*cos(x)^2 + 2*sin(x)^2 - 2*sqrt(2)*cos(x) - 2*sqrt(2)
*sin(x) + 2) - 1/8*log(cos(x)^2 + sin(x)^2 + 2*sin(x) + 1) + 1/8*log(cos(x)^2 + sin(x)^2 - 2*sin(x) + 1) + sin
(x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 50 vs. \(2 (20) = 40\).

Time = 0.26 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.79 \[ \int \cot (4 x) \sin (x) \, dx=\frac {1}{8} \, \sqrt {2} \log \left (\frac {{\left | -2 \, \sqrt {2} + 4 \, \sin \left (x\right ) \right |}}{{\left | 2 \, \sqrt {2} + 4 \, \sin \left (x\right ) \right |}}\right ) - \frac {1}{8} \, \log \left (\sin \left (x\right ) + 1\right ) + \frac {1}{8} \, \log \left (-\sin \left (x\right ) + 1\right ) + \sin \left (x\right ) \]

[In]

integrate(cot(4*x)*sin(x),x, algorithm="giac")

[Out]

1/8*sqrt(2)*log(abs(-2*sqrt(2) + 4*sin(x))/abs(2*sqrt(2) + 4*sin(x))) - 1/8*log(sin(x) + 1) + 1/8*log(-sin(x)
+ 1) + sin(x)

Mupad [B] (verification not implemented)

Time = 25.32 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.04 \[ \int \cot (4 x) \sin (x) \, dx=\sin \left (x\right )-\frac {\mathrm {atanh}\left (\frac {\sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )}\right )}{2}-\frac {\sqrt {2}\,\mathrm {atanh}\left (\sqrt {2}\,\sin \left (x\right )\right )}{4} \]

[In]

int(cot(4*x)*sin(x),x)

[Out]

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