\(\int \cos (x) \cot (x) \, dx\) [104]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (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 = 5, antiderivative size = 8 \[ \int \cos (x) \cot (x) \, dx=-\text {arctanh}(\cos (x))+\cos (x) \]

[Out]

-arctanh(cos(x))+cos(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.600, Rules used = {2672, 327, 212} \[ \int \cos (x) \cot (x) \, dx=\cos (x)-\text {arctanh}(\cos (x)) \]

[In]

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

[Out]

-ArcTanh[Cos[x]] + Cos[x]

Rule 212

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

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(19\) vs. \(2(8)=16\).

Time = 0.02 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.38 \[ \int \cos (x) \cot (x) \, dx=\cos (x)-\log \left (\cos \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.11 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.50

method result size
default \(\cos \left (x \right )+\ln \left (\csc \left (x \right )-\cot \left (x \right )\right )\) \(12\)
parallelrisch \(\cos \left (x \right )+\ln \left (\csc \left (x \right )-\cot \left (x \right )\right )+1\) \(13\)
norman \(\frac {2}{1+\tan ^{2}\left (\frac {x}{2}\right )}+\ln \left (\tan \left (\frac {x}{2}\right )\right )\) \(19\)
risch \(\frac {{\mathrm e}^{i x}}{2}+\frac {{\mathrm e}^{-i x}}{2}+\ln \left ({\mathrm e}^{i x}-1\right )-\ln \left ({\mathrm e}^{i x}+1\right )\) \(34\)

[In]

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

[Out]

cos(x)+ln(csc(x)-cot(x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 21 vs. \(2 (8) = 16\).

Time = 0.24 (sec) , antiderivative size = 21, normalized size of antiderivative = 2.62 \[ \int \cos (x) \cot (x) \, dx=\cos \left (x\right ) - \frac {1}{2} \, \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) + \frac {1}{2} \, \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \]

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 19 vs. \(2 (7) = 14\).

Time = 0.04 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.38 \[ \int \cos (x) \cot (x) \, dx=\frac {\log {\left (\cos {\left (x \right )} - 1 \right )}}{2} - \frac {\log {\left (\cos {\left (x \right )} + 1 \right )}}{2} + \cos {\left (x \right )} \]

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 17 vs. \(2 (8) = 16\).

Time = 0.18 (sec) , antiderivative size = 17, normalized size of antiderivative = 2.12 \[ \int \cos (x) \cot (x) \, dx=\cos \left (x\right ) - \frac {1}{2} \, \log \left (\cos \left (x\right ) + 1\right ) + \frac {1}{2} \, \log \left (\cos \left (x\right ) - 1\right ) \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 19 vs. \(2 (8) = 16\).

Time = 0.28 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.38 \[ \int \cos (x) \cot (x) \, dx=\cos \left (x\right ) - \frac {1}{2} \, \log \left (\cos \left (x\right ) + 1\right ) + \frac {1}{2} \, \log \left (-\cos \left (x\right ) + 1\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.00 \[ \int \cos (x) \cot (x) \, dx=\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )+\cos \left (x\right ) \]

[In]

int(cos(x)^2/sin(x),x)

[Out]

log(tan(x/2)) + cos(x)