3.4.28 \(\int x \sec (x) \tan (x) \, dx\) [328]

Optimal. Leaf size=10 \[ -\tanh ^{-1}(\sin (x))+x \sec (x) \]

[Out]

-arctanh(sin(x))+x*sec(x)

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 10, normalized size of antiderivative = 1.00, 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 = {3842, 3855} \begin {gather*} x \sec (x)-\tanh ^{-1}(\sin (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x*Sec[x]*Tan[x],x]

[Out]

-ArcTanh[Sin[x]] + x*Sec[x]

Rule 3842

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]

Rule 3855

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

Rubi steps

\begin {align*} \int x \sec (x) \tan (x) \, dx &=x \sec (x)-\int \sec (x) \, dx\\ &=-\tanh ^{-1}(\sin (x))+x \sec (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(37\) vs. \(2(10)=20\).
time = 0.01, size = 37, normalized size = 3.70 \begin {gather*} \log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )-\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )+x \sec (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x*Sec[x]*Tan[x],x]

[Out]

Log[Cos[x/2] - Sin[x/2]] - Log[Cos[x/2] + Sin[x/2]] + x*Sec[x]

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 16, normalized size = 1.60

method result size
default \(\frac {x}{\cos \left (x \right )}-\ln \left (\sec \left (x \right )+\tan \left (x \right )\right )\) \(16\)
risch \(\frac {2 x \,{\mathrm e}^{i x}}{{\mathrm e}^{2 i x}+1}+\ln \left ({\mathrm e}^{i x}-i\right )-\ln \left ({\mathrm e}^{i x}+i\right )\) \(39\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*sec(x)*tan(x),x,method=_RETURNVERBOSE)

[Out]

x/cos(x)-ln(sec(x)+tan(x))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 121 vs. \(2 (10) = 20\).
time = 2.37, size = 121, normalized size = 12.10 \begin {gather*} \frac {4 \, x \cos \left (2 \, x\right ) \cos \left (x\right ) + 4 \, x \sin \left (2 \, x\right ) \sin \left (x\right ) + 4 \, x \cos \left (x\right ) - {\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 (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \sin \left (x\right ) + 1\right ) + {\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 (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \sin \left (x\right ) + 1\right )}{2 \, {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(4*x*cos(2*x)*cos(x) + 4*x*sin(2*x)*sin(x) + 4*x*cos(x) - (cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)*log(c
os(x)^2 + sin(x)^2 + 2*sin(x) + 1) + (cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)*log(cos(x)^2 + sin(x)^2 - 2*si
n(x) + 1))/(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 29 vs. \(2 (10) = 20\).
time = 0.96, size = 29, normalized size = 2.90 \begin {gather*} -\frac {\cos \left (x\right ) \log \left (\sin \left (x\right ) + 1\right ) - \cos \left (x\right ) \log \left (-\sin \left (x\right ) + 1\right ) - 2 \, x}{2 \, \cos \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x \tan {\left (x \right )} \sec {\left (x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(x*tan(x)*sec(x), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 150 vs. \(2 (10) = 20\).
time = 1.63, size = 150, normalized size = 15.00 \begin {gather*} -\frac {2 \, x \tan \left (\frac {1}{2} \, x\right )^{2} + \log \left (\frac {2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, x\right ) + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} - \log \left (\frac {2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, \tan \left (\frac {1}{2} \, x\right ) + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, x - \log \left (\frac {2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, x\right ) + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) + \log \left (\frac {2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, \tan \left (\frac {1}{2} \, x\right ) + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right )}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.11, size = 19, normalized size = 1.90 \begin {gather*} \frac {x}{\cos \left (x\right )}+\mathrm {atan}\left (\cos \left (x\right )+\sin \left (x\right )\,1{}\mathrm {i}\right )\,2{}\mathrm {i} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x*tan(x))/cos(x),x)

[Out]

atan(cos(x) + sin(x)*1i)*2i + x/cos(x)

________________________________________________________________________________________