\(\int \tan ^2(x) \, dx\) [42]

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

Optimal result

Integrand size = 4, antiderivative size = 6 \[ \int \tan ^2(x) \, dx=-x+\tan (x) \]

[Out]

-x+tan(x)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3554, 8} \[ \int \tan ^2(x) \, dx=\tan (x)-x \]

[In]

Int[Tan[x]^2,x]

[Out]

-x + Tan[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \tan (x)-\int 1 \, dx \\ & = -x+\tan (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.33 \[ \int \tan ^2(x) \, dx=-\arctan (\tan (x))+\tan (x) \]

[In]

Integrate[Tan[x]^2,x]

[Out]

-ArcTan[Tan[x]] + Tan[x]

Maple [A] (verified)

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

method result size
norman \(-x +\tan \left (x \right )\) \(7\)
parallelrisch \(-x +\tan \left (x \right )\) \(7\)
derivativedivides \(\tan \left (x \right )-\arctan \left (\tan \left (x \right )\right )\) \(9\)
default \(\tan \left (x \right )-\arctan \left (\tan \left (x \right )\right )\) \(9\)
risch \(-x +\frac {2 i}{{\mathrm e}^{2 i x}+1}\) \(17\)

[In]

int(tan(x)^2,x,method=_RETURNVERBOSE)

[Out]

-x+tan(x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \tan ^2(x) \, dx=-x + \tan \left (x\right ) \]

[In]

integrate(tan(x)^2,x, algorithm="fricas")

[Out]

-x + tan(x)

Sympy [B] (verification not implemented)

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

Time = 0.03 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.17 \[ \int \tan ^2(x) \, dx=- x + \frac {\sin {\left (x \right )}}{\cos {\left (x \right )}} \]

[In]

integrate(tan(x)**2,x)

[Out]

-x + sin(x)/cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \tan ^2(x) \, dx=-x + \tan \left (x\right ) \]

[In]

integrate(tan(x)^2,x, algorithm="maxima")

[Out]

-x + tan(x)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \tan ^2(x) \, dx=-x + \tan \left (x\right ) \]

[In]

integrate(tan(x)^2,x, algorithm="giac")

[Out]

-x + tan(x)

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \tan ^2(x) \, dx=\mathrm {tan}\left (x\right )-x \]

[In]

int(tan(x)^2,x)

[Out]

tan(x) - x