3.752 \(\int x \sec ^2(x) \, dx\)

Optimal. Leaf size=8 \[ x \tan (x)+\log (\cos (x)) \]

[Out]

Log[Cos[x]] + x*Tan[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0177246, antiderivative size = 8, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 6, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.333, Rules used = {4184, 3475} \[ x \tan (x)+\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

Log[Cos[x]] + x*Tan[x]

Rule 4184

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

Rule 3475

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

Rubi steps

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

Mathematica [A]  time = 0.0053494, size = 8, normalized size = 1. \[ x \tan (x)+\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

Log[Cos[x]] + x*Tan[x]

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 9, normalized size = 1.1 \begin{align*} \ln \left ( \cos \left ( x \right ) \right ) +x\tan \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

ln(cos(x))+x*tan(x)

________________________________________________________________________________________

Maxima [B]  time = 1.46013, size = 100, normalized size = 12.5 \begin{align*} \frac{{\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 )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/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)

________________________________________________________________________________________

Fricas [B]  time = 2.14376, size = 55, normalized size = 6.88 \begin{align*} \frac{\cos \left (x\right ) \log \left (-\cos \left (x\right )\right ) + x \sin \left (x\right )}{\cos \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int x \sec ^{2}{\left (x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*sec(x)**2,x)

[Out]

Integral(x*sec(x)**2, x)

________________________________________________________________________________________

Giac [B]  time = 1.13281, size = 139, normalized size = 17.38 \begin{align*} \frac{\log \left (\frac{4 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac{1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac{1}{2} \, x\right )^{2} - 4 \, x \tan \left (\frac{1}{2} \, x\right ) - \log \left (\frac{4 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac{1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1}\right )}{2 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{2} - 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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