3.82 \(\int x \tan ^2(x) \, dx\)

Optimal. Leaf size=15 \[ -\frac {x^2}{2}+x \tan (x)+\log (\cos (x)) \]

________________________________________________________________________________________

Rubi [A]  time = 0.01, antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3720, 3475, 30} \[ -\frac {x^2}{2}+x \tan (x)+\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[x*Tan[x]^2,x]

[Out]

-x^2/2 + Log[Cos[x]] + x*Tan[x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rubi steps

\begin {align*} \int x \tan ^2(x) \, dx &=x \tan (x)-\int x \, dx-\int \tan (x) \, dx\\ &=-\frac {x^2}{2}+\log (\cos (x))+x \tan (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.02, size = 15, normalized size = 1.00 \[ -\frac {x^2}{2}+x \tan (x)+\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Tan[x]^2,x]

[Out]

-1/2*x^2 + Log[Cos[x]] + x*Tan[x]

________________________________________________________________________________________

IntegrateAlgebraic [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int x \tan ^2(x) \, dx \]

Verification is Not applicable to the result.

[In]

IntegrateAlgebraic[x*Tan[x]^2,x]

[Out]

Could not integrate

________________________________________________________________________________________

fricas [A]  time = 0.83, size = 21, normalized size = 1.40 \[ -\frac {1}{2} \, x^{2} + x \tan \relax (x) + \frac {1}{2} \, \log \left (\frac {1}{\tan \relax (x)^{2} + 1}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 1.00, size = 23, normalized size = 1.53 \[ -\frac {1}{2} \, x^{2} + x \tan \relax (x) + \frac {1}{2} \, \log \left (\frac {4}{\tan \relax (x)^{2} + 1}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.03, size = 20, normalized size = 1.33




method result size



norman \(x \tan \relax (x )-\frac {x^{2}}{2}-\frac {\ln \left (1+\tan ^{2}\relax (x )\right )}{2}\) \(20\)
risch \(-\frac {x^{2}}{2}-2 i x +\frac {2 i x}{1+{\mathrm e}^{2 i x}}+\ln \left (1+{\mathrm e}^{2 i x}\right )\) \(32\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [B]  time = 0.99, size = 107, normalized size = 7.13 \[ -\frac {x^{2} \cos \left (2 \, x\right )^{2} + x^{2} \sin \left (2 \, x\right )^{2} + 2 \, x^{2} \cos \left (2 \, x\right ) + x^{2} - {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) - 4 \, x \sin \left (2 \, x\right )}{2 \, {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.02, size = 13, normalized size = 0.87 \[ \ln \left (\cos \relax (x)\right )+x\,\mathrm {tan}\relax (x)-\frac {x^2}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*tan(x)^2,x)

[Out]

log(cos(x)) + x*tan(x) - x^2/2

________________________________________________________________________________________

sympy [A]  time = 0.18, size = 19, normalized size = 1.27 \[ - \frac {x^{2}}{2} + x \tan {\relax (x )} - \frac {\log {\left (\tan ^{2}{\relax (x )} + 1 \right )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________