\(\int \cos (x) \cot (4 x) \, dx\) [112]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (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 \cos (x) \cot (4 x) \, dx=-\frac {1}{4} \text {arctanh}(\cos (x))-\frac {\text {arctanh}\left (\sqrt {2} \cos (x)\right )}{2 \sqrt {2}}+\cos (x) \]

[Out]

-1/4*arctanh(cos(x))+cos(x)-1/4*arctanh(cos(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 \cos (x) \cot (4 x) \, dx=-\frac {1}{4} \text {arctanh}(\cos (x))-\frac {\text {arctanh}\left (\sqrt {2} \cos (x)\right )}{2 \sqrt {2}}+\cos (x) \]

[In]

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

[Out]

-1/4*ArcTanh[Cos[x]] - ArcTanh[Sqrt[2]*Cos[x]]/(2*Sqrt[2]) + Cos[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,\cos (x)\right ) \\ & = -\text {Subst}\left (\int \left (-1+\frac {3-4 x^2}{4-12 x^2+8 x^4}\right ) \, dx,x,\cos (x)\right ) \\ & = \cos (x)-\text {Subst}\left (\int \frac {3-4 x^2}{4-12 x^2+8 x^4} \, dx,x,\cos (x)\right ) \\ & = \cos (x)+2 \text {Subst}\left (\int \frac {1}{-8+8 x^2} \, dx,x,\cos (x)\right )+2 \text {Subst}\left (\int \frac {1}{-4+8 x^2} \, dx,x,\cos (x)\right ) \\ & = -\frac {1}{4} \text {arctanh}(\cos (x))-\frac {\text {arctanh}\left (\sqrt {2} \cos (x)\right )}{2 \sqrt {2}}+\cos (x) \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.11 (sec) , antiderivative size = 73, normalized size of antiderivative = 2.61 \[ \int \cos (x) \cot (4 x) \, dx=\frac {1}{4} \left ((-1-i) (-1)^{3/4} \text {arctanh}\left (\frac {-1+\tan \left (\frac {x}{2}\right )}{\sqrt {2}}\right )-(1-i) \sqrt [4]{-1} \text {arctanh}\left (\frac {1+\tan \left (\frac {x}{2}\right )}{\sqrt {2}}\right )+4 \cos (x)-\log \left (\cos \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )\right )\right ) \]

[In]

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

[Out]

((-1 - I)*(-1)^(3/4)*ArcTanh[(-1 + Tan[x/2])/Sqrt[2]] - (1 - I)*(-1)^(1/4)*ArcTanh[(1 + Tan[x/2])/Sqrt[2]] + 4
*Cos[x] - Log[Cos[x/2]] + Log[Sin[x/2]])/4

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 1.11 (sec) , antiderivative size = 81, normalized size of antiderivative = 2.89

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

[In]

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

[Out]

1/2*exp(I*x)+1/2*exp(-I*x)+1/4*ln(exp(I*x)-1)-1/4*ln(exp(I*x)+1)-1/8*2^(1/2)*ln(exp(2*I*x)+2^(1/2)*exp(I*x)+1)
+1/8*2^(1/2)*ln(exp(2*I*x)-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. 53 vs. \(2 (20) = 40\).

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

[In]

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

[Out]

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

Sympy [F]

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

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

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

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

[In]

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

[Out]

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

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.27 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.79 \[ \int \cos (x) \cot (4 x) \, dx=\frac {1}{8} \, \sqrt {2} \log \left (\frac {{\left | -2 \, \sqrt {2} + 4 \, \cos \left (x\right ) \right |}}{{\left | 2 \, \sqrt {2} + 4 \, \cos \left (x\right ) \right |}}\right ) + \cos \left (x\right ) - \frac {1}{8} \, \log \left (\cos \left (x\right ) + 1\right ) + \frac {1}{8} \, \log \left (-\cos \left (x\right ) + 1\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 26.45 (sec) , antiderivative size = 67, normalized size of antiderivative = 2.39 \[ \int \cos (x) \cot (4 x) \, dx=\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{4}-\frac {\sqrt {2}\,\mathrm {atanh}\left (\frac {7\,\sqrt {2}}{8\,\left (\frac {29\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{4}-\frac {5}{4}\right )}-\frac {41\,\sqrt {2}\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{8\,\left (\frac {29\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{4}-\frac {5}{4}\right )}\right )}{4}+\frac {2}{{\mathrm {tan}\left (\frac {x}{2}\right )}^2+1} \]

[In]

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

[Out]

log(tan(x/2))/4 - (2^(1/2)*atanh((7*2^(1/2))/(8*((29*tan(x/2)^2)/4 - 5/4)) - (41*2^(1/2)*tan(x/2)^2)/(8*((29*t
an(x/2)^2)/4 - 5/4))))/4 + 2/(tan(x/2)^2 + 1)