\(\int (1+\frac {1}{1+\cot ^2(x)}) \csc ^2(x) \, dx\) [719]

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

Optimal result

Integrand size = 15, antiderivative size = 6 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=x-\cot (x) \]

[Out]

x-cot(x)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {14, 209} \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=x-\cot (x) \]

[In]

Int[(1 + (1 + Cot[x]^2)^(-1))*Csc[x]^2,x]

[Out]

x - Cot[x]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 209

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

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

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.01 (sec) , antiderivative size = 22, normalized size of antiderivative = 3.67 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=2 x-\cot (x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(x)\right ) \]

[In]

Integrate[(1 + (1 + Cot[x]^2)^(-1))*Csc[x]^2,x]

[Out]

2*x - Cot[x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[x]^2]

Maple [A] (verified)

Time = 3.27 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.17

method result size
default \(x -\cot \left (x \right )\) \(7\)
risch \(x -\frac {2 i}{{\mathrm e}^{2 i x}-1}\) \(15\)

[In]

int((1+1/(1+cot(x)^2))*csc(x)^2,x,method=_RETURNVERBOSE)

[Out]

x-cot(x)

Fricas [B] (verification not implemented)

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

Time = 0.24 (sec) , antiderivative size = 14, normalized size of antiderivative = 2.33 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=\frac {x \sin \left (x\right ) - \cos \left (x\right )}{\sin \left (x\right )} \]

[In]

integrate((1+1/(1+cot(x)^2))*csc(x)^2,x, algorithm="fricas")

[Out]

(x*sin(x) - cos(x))/sin(x)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 27 vs. \(2 (3) = 6\).

Time = 0.26 (sec) , antiderivative size = 27, normalized size of antiderivative = 4.50 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=\frac {x \csc ^{2}{\left (x \right )}}{\cot ^{2}{\left (x \right )} + 1} - \frac {\cot {\left (x \right )} \csc ^{2}{\left (x \right )}}{\cot ^{2}{\left (x \right )} + 1} \]

[In]

integrate((1+1/(1+cot(x)**2))*csc(x)**2,x)

[Out]

x*csc(x)**2/(cot(x)**2 + 1) - cot(x)*csc(x)**2/(cot(x)**2 + 1)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.33 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=x - \frac {1}{\tan \left (x\right )} \]

[In]

integrate((1+1/(1+cot(x)^2))*csc(x)^2,x, algorithm="maxima")

[Out]

x - 1/tan(x)

Giac [B] (verification not implemented)

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

Time = 0.29 (sec) , antiderivative size = 16, normalized size of antiderivative = 2.67 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=x - \frac {1}{2 \, \tan \left (\frac {1}{2} \, x\right )} + \frac {1}{2} \, \tan \left (\frac {1}{2} \, x\right ) \]

[In]

integrate((1+1/(1+cot(x)^2))*csc(x)^2,x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 26.24 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \left (1+\frac {1}{1+\cot ^2(x)}\right ) \csc ^2(x) \, dx=x-\mathrm {cot}\left (x\right ) \]

[In]

int((1/(cot(x)^2 + 1) + 1)/sin(x)^2,x)

[Out]

x - cot(x)