3.842 \(\int x \sec (x) (2+x \tan (x)) \, dx\)

Optimal. Leaf size=6 \[ x^2 \sec (x) \]

[Out]

x^2*Sec[x]

________________________________________________________________________________________

Rubi [A]  time = 0.178028, antiderivative size = 6, normalized size of antiderivative = 1., number of steps used = 13, number of rules used = 5, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.5, Rules used = {6742, 4181, 2279, 2391, 3757} \[ x^2 \sec (x) \]

Antiderivative was successfully verified.

[In]

Int[x*Sec[x]*(2 + x*Tan[x]),x]

[Out]

x^2*Sec[x]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rule 4181

Int[csc[(e_.) + Pi*(k_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-2*(c + d*x)^m*ArcTanh[E
^(I*k*Pi)*E^(I*(e + f*x))])/f, x] + (-Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Log[1 - E^(I*k*Pi)*E^(I*(e + f*x))],
 x], x] + Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Log[1 + E^(I*k*Pi)*E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e,
f}, x] && IntegerQ[2*k] && IGtQ[m, 0]

Rule 2279

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3757

Int[(x_)^(m_.)*Sec[(a_.) + (b_.)*(x_)^(n_.)]^(p_.)*Tan[(a_.) + (b_.)*(x_)^(n_.)]^(q_.), x_Symbol] :> Simp[(x^(
m - n + 1)*Sec[a + b*x^n]^p)/(b*n*p), x] - Dist[(m - n + 1)/(b*n*p), Int[x^(m - n)*Sec[a + b*x^n]^p, x], x] /;
 FreeQ[{a, b, p}, x] && IntegerQ[n] && GeQ[m, n] && EqQ[q, 1]

Rubi steps

\begin{align*} \int x \sec (x) (2+x \tan (x)) \, dx &=\int \left (2 x \sec (x)+x^2 \sec (x) \tan (x)\right ) \, dx\\ &=2 \int x \sec (x) \, dx+\int x^2 \sec (x) \tan (x) \, dx\\ &=-4 i x \tan ^{-1}\left (e^{i x}\right )+x^2 \sec (x)-2 \int \log \left (1-i e^{i x}\right ) \, dx+2 \int \log \left (1+i e^{i x}\right ) \, dx-2 \int x \sec (x) \, dx\\ &=x^2 \sec (x)+2 i \operatorname{Subst}\left (\int \frac{\log (1-i x)}{x} \, dx,x,e^{i x}\right )-2 i \operatorname{Subst}\left (\int \frac{\log (1+i x)}{x} \, dx,x,e^{i x}\right )+2 \int \log \left (1-i e^{i x}\right ) \, dx-2 \int \log \left (1+i e^{i x}\right ) \, dx\\ &=2 i \text{Li}_2\left (-i e^{i x}\right )-2 i \text{Li}_2\left (i e^{i x}\right )+x^2 \sec (x)-2 i \operatorname{Subst}\left (\int \frac{\log (1-i x)}{x} \, dx,x,e^{i x}\right )+2 i \operatorname{Subst}\left (\int \frac{\log (1+i x)}{x} \, dx,x,e^{i x}\right )\\ &=x^2 \sec (x)\\ \end{align*}

Mathematica [A]  time = 0.024492, size = 6, normalized size = 1. \[ x^2 \sec (x) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Sec[x]*(2 + x*Tan[x]),x]

[Out]

x^2*Sec[x]

________________________________________________________________________________________

Maple [C]  time = 0.035, size = 20, normalized size = 3.3 \begin{align*} 2\,{\frac{{x}^{2}{{\rm e}^{ix}}}{1+{{\rm e}^{2\,ix}}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*sec(x)*(2+x*tan(x)),x)

[Out]

2*x^2*exp(I*x)/(1+exp(2*I*x))

________________________________________________________________________________________

Maxima [B]  time = 1.66423, size = 69, normalized size = 11.5 \begin{align*} \frac{2 \,{\left (x^{2} \cos \left (2 \, x\right ) \cos \left (x\right ) + x^{2} \sin \left (2 \, x\right ) \sin \left (x\right ) + x^{2} \cos \left (x\right )\right )}}{\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*(x^2*cos(2*x)*cos(x) + x^2*sin(2*x)*sin(x) + x^2*cos(x))/(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)

________________________________________________________________________________________

Fricas [A]  time = 1.96152, size = 16, normalized size = 2.67 \begin{align*} \frac{x^{2}}{\cos \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x^2/cos(x)

________________________________________________________________________________________

Sympy [A]  time = 0.552568, size = 5, normalized size = 0.83 \begin{align*} x^{2} \sec{\left (x \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2*sec(x)

________________________________________________________________________________________

Giac [B]  time = 1.09754, size = 35, normalized size = 5.83 \begin{align*} -\frac{x^{2} \tan \left (\frac{1}{2} \, x\right )^{2} + x^{2}}{\tan \left (\frac{1}{2} \, x\right )^{2} - 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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