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

Optimal. Leaf size=6 \[ -x+\tan (x) \]

[Out]

-x+tan(x)

________________________________________________________________________________________

Rubi [A]
time = 0.00, antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3554, 8} \begin {gather*} \tan (x)-x \end {gather*}

Antiderivative was successfully verified.

[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*} \int \tan ^2(x) \, dx &=\tan (x)-\int 1 \, dx\\ &=-x+\tan (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.00, size = 6, normalized size = 1.00 \begin {gather*} -x+\tan (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[x]^2,x]

[Out]

-x + Tan[x]

________________________________________________________________________________________

Mathics [A]
time = 1.73, size = 6, normalized size = 1.00 \begin {gather*} -x+\text {Tan}\left [x\right ] \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[Tan[x]^2,x]')

[Out]

-x + Tan[x]

________________________________________________________________________________________

Maple [A]
time = 0.01, size = 9, normalized size = 1.50

method result size
norman \(-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\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

tan(x)-arctan(tan(x))

________________________________________________________________________________________

Maxima [A]
time = 0.34, size = 6, normalized size = 1.00 \begin {gather*} -x + \tan \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x + tan(x)

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 6, normalized size = 1.00 \begin {gather*} -x + \tan \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x + tan(x)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 7 vs. \(2 (3) = 6\)
time = 0.03, size = 7, normalized size = 1.17 \begin {gather*} - x + \frac {\sin {\left (x \right )}}{\cos {\left (x \right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 5, normalized size = 0.83 \begin {gather*} \tan x-x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(x)^2,x)

[Out]

-x + tan(x)

________________________________________________________________________________________

Mupad [B]
time = 0.03, size = 6, normalized size = 1.00 \begin {gather*} \mathrm {tan}\left (x\right )-x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(x)^2,x)

[Out]

tan(x) - x

________________________________________________________________________________________