\(\int \sec (x) \tan ^2(x) \, dx\) [255]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 7, antiderivative size = 16 \[ \int \sec (x) \tan ^2(x) \, dx=-\frac {1}{2} \text {arctanh}(\sin (x))+\frac {1}{2} \sec (x) \tan (x) \]

[Out]

-1/2*arctanh(sin(x))+1/2*sec(x)*tan(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2691, 3855} \[ \int \sec (x) \tan ^2(x) \, dx=\frac {1}{2} \tan (x) \sec (x)-\frac {1}{2} \text {arctanh}(\sin (x)) \]

[In]

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

[Out]

-1/2*ArcTanh[Sin[x]] + (Sec[x]*Tan[x])/2

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

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*} \text {integral}& = \frac {1}{2} \sec (x) \tan (x)-\frac {1}{2} \int \sec (x) \, dx \\ & = -\frac {1}{2} \text {arctanh}(\sin (x))+\frac {1}{2} \sec (x) \tan (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00 \[ \int \sec (x) \tan ^2(x) \, dx=-\frac {1}{2} \text {arctanh}(\sin (x))+\frac {1}{2} \sec (x) \tan (x) \]

[In]

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

[Out]

-1/2*ArcTanh[Sin[x]] + (Sec[x]*Tan[x])/2

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.50

method result size
default \(\frac {\sin ^{3}\left (x \right )}{2 \cos \left (x \right )^{2}}+\frac {\sin \left (x \right )}{2}-\frac {\ln \left (\sec \left (x \right )+\tan \left (x \right )\right )}{2}\) \(24\)
risch \(-\frac {i \left ({\mathrm e}^{3 i x}-{\mathrm e}^{i x}\right )}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}-\frac {\ln \left (i+{\mathrm e}^{i x}\right )}{2}+\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{2}\) \(49\)

[In]

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

[Out]

1/2*sin(x)^3/cos(x)^2+1/2*sin(x)-1/2*ln(sec(x)+tan(x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 34 vs. \(2 (12) = 24\).

Time = 0.25 (sec) , antiderivative size = 34, normalized size of antiderivative = 2.12 \[ \int \sec (x) \tan ^2(x) \, dx=-\frac {\cos \left (x\right )^{2} \log \left (\sin \left (x\right ) + 1\right ) - \cos \left (x\right )^{2} \log \left (-\sin \left (x\right ) + 1\right ) - 2 \, \sin \left (x\right )}{4 \, \cos \left (x\right )^{2}} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.69 \[ \int \sec (x) \tan ^2(x) \, dx=\frac {\log {\left (\sin {\left (x \right )} - 1 \right )}}{4} - \frac {\log {\left (\sin {\left (x \right )} + 1 \right )}}{4} - \frac {\sin {\left (x \right )}}{2 \sin ^{2}{\left (x \right )} - 2} \]

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 27 vs. \(2 (12) = 24\).

Time = 0.19 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.69 \[ \int \sec (x) \tan ^2(x) \, dx=-\frac {\sin \left (x\right )}{2 \, {\left (\sin \left (x\right )^{2} - 1\right )}} - \frac {1}{4} \, \log \left (\sin \left (x\right ) + 1\right ) + \frac {1}{4} \, \log \left (\sin \left (x\right ) - 1\right ) \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 29 vs. \(2 (12) = 24\).

Time = 0.27 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.81 \[ \int \sec (x) \tan ^2(x) \, dx=-\frac {\sin \left (x\right )}{2 \, {\left (\sin \left (x\right )^{2} - 1\right )}} - \frac {1}{4} \, \log \left (\sin \left (x\right ) + 1\right ) + \frac {1}{4} \, \log \left (-\sin \left (x\right ) + 1\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.00 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.88 \[ \int \sec (x) \tan ^2(x) \, dx=\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^3+\mathrm {tan}\left (\frac {x}{2}\right )}{{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right )}^2}-\mathrm {atanh}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right ) \]

[In]

int(tan(x)^2/cos(x),x)

[Out]

(tan(x/2) + tan(x/2)^3)/(tan(x/2)^2 - 1)^2 - atanh(tan(x/2))