\(\int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx\) [697]

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

Optimal result

Integrand size = 16, antiderivative size = 10 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\cot (x)+\log (1+\cot (x)) \]

[Out]

-cot(x)+ln(1+cot(x))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.50, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {4427, 46} \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\cot (x)-\log (\tan (x))+\log (\tan (x)+1) \]

[In]

Int[Sec[x]^2/(Tan[x]^2 + Tan[x]^3),x]

[Out]

-Cot[x] - Log[Tan[x]] + Log[1 + Tan[x]]

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 4427

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

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

Mathematica [A] (verified)

Time = 0.15 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.60 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\cot (x)-\log (\sin (x))+\log (\cos (x)+\sin (x)) \]

[In]

Integrate[Sec[x]^2/(Tan[x]^2 + Tan[x]^3),x]

[Out]

-Cot[x] - Log[Sin[x]] + Log[Cos[x] + Sin[x]]

Maple [A] (verified)

Time = 1.35 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.80

method result size
default \(\ln \left (1+\tan \left (x \right )\right )-\frac {1}{\tan \left (x \right )}-\ln \left (\tan \left (x \right )\right )\) \(18\)
risch \(-\frac {2 i}{{\mathrm e}^{2 i x}-1}-\ln \left ({\mathrm e}^{2 i x}-1\right )+\ln \left (i+{\mathrm e}^{2 i x}\right )\) \(33\)

[In]

int(sec(x)^2/(tan(x)^2+tan(x)^3),x,method=_RETURNVERBOSE)

[Out]

ln(1+tan(x))-1/tan(x)-ln(tan(x))

Fricas [B] (verification not implemented)

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

Time = 0.24 (sec) , antiderivative size = 36, normalized size of antiderivative = 3.60 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\frac {\log \left (-\frac {1}{4} \, \cos \left (x\right )^{2} + \frac {1}{4}\right ) \sin \left (x\right ) - \log \left (2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) \sin \left (x\right ) + 2 \, \cos \left (x\right )}{2 \, \sin \left (x\right )} \]

[In]

integrate(sec(x)^2/(tan(x)^2+tan(x)^3),x, algorithm="fricas")

[Out]

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

Sympy [F]

\[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=\int \frac {\sec ^{2}{\left (x \right )}}{\left (\tan {\left (x \right )} + 1\right ) \tan ^{2}{\left (x \right )}}\, dx \]

[In]

integrate(sec(x)**2/(tan(x)**2+tan(x)**3),x)

[Out]

Integral(sec(x)**2/((tan(x) + 1)*tan(x)**2), x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.70 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\frac {1}{\tan \left (x\right )} + \log \left (\tan \left (x\right ) + 1\right ) - \log \left (\tan \left (x\right )\right ) \]

[In]

integrate(sec(x)^2/(tan(x)^2+tan(x)^3),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.90 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=-\frac {1}{\tan \left (x\right )} + \log \left ({\left | \tan \left (x\right ) + 1 \right |}\right ) - \log \left ({\left | \tan \left (x\right ) \right |}\right ) \]

[In]

integrate(sec(x)^2/(tan(x)^2+tan(x)^3),x, algorithm="giac")

[Out]

-1/tan(x) + log(abs(tan(x) + 1)) - log(abs(tan(x)))

Mupad [B] (verification not implemented)

Time = 27.75 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.60 \[ \int \frac {\sec ^2(x)}{\tan ^2(x)+\tan ^3(x)} \, dx=2\,\mathrm {atanh}\left (2\,\mathrm {tan}\left (x\right )+1\right )-\frac {1}{\mathrm {tan}\left (x\right )} \]

[In]

int(1/(cos(x)^2*(tan(x)^2 + tan(x)^3)),x)

[Out]

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