\(\int \frac {\sec ^2(x)}{1-\tan ^2(x)} \, dx\) [691]

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

Optimal result

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

[Out]

1/2*arctanh(2*cos(x)*sin(x))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 11, 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.133, Rules used = {3756, 212} \[ \int \frac {\sec ^2(x)}{1-\tan ^2(x)} \, dx=\frac {1}{2} \text {arctanh}(2 \sin (x) \cos (x)) \]

[In]

Int[Sec[x]^2/(1 - Tan[x]^2),x]

[Out]

ArcTanh[2*Cos[x]*Sin[x]]/2

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 3756

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\tan (x)\right ) \\ & = \frac {1}{2} \text {arctanh}(2 \cos (x) \sin (x)) \\ \end{align*}

Mathematica [A] (verified)

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

[In]

Integrate[Sec[x]^2/(1 - Tan[x]^2),x]

[Out]

ArcTanh[Sin[2*x]]/2

Maple [A] (verified)

Time = 0.95 (sec) , antiderivative size = 4, normalized size of antiderivative = 0.36

method result size
default \(\operatorname {arctanh}\left (\tan \left (x \right )\right )\) \(4\)
risch \(-\frac {\ln \left ({\mathrm e}^{2 i x}-i\right )}{2}+\frac {\ln \left (i+{\mathrm e}^{2 i x}\right )}{2}\) \(24\)

[In]

int(sec(x)^2/(1-tan(x)^2),x,method=_RETURNVERBOSE)

[Out]

arctanh(tan(x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 23 vs. \(2 (9) = 18\).

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

[In]

integrate(sec(x)^2/(1-tan(x)^2),x, algorithm="fricas")

[Out]

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

Sympy [F]

\[ \int \frac {\sec ^2(x)}{1-\tan ^2(x)} \, dx=- \int \frac {\sec ^{2}{\left (x \right )}}{\tan ^{2}{\left (x \right )} - 1}\, dx \]

[In]

integrate(sec(x)**2/(1-tan(x)**2),x)

[Out]

-Integral(sec(x)**2/(tan(x)**2 - 1), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.36 \[ \int \frac {\sec ^2(x)}{1-\tan ^2(x)} \, dx=\frac {1}{2} \, \log \left (\tan \left (x\right ) + 1\right ) - \frac {1}{2} \, \log \left (\tan \left (x\right ) - 1\right ) \]

[In]

integrate(sec(x)^2/(1-tan(x)^2),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.55 \[ \int \frac {\sec ^2(x)}{1-\tan ^2(x)} \, dx=\frac {1}{2} \, \log \left ({\left | \tan \left (x\right ) + 1 \right |}\right ) - \frac {1}{2} \, \log \left ({\left | \tan \left (x\right ) - 1 \right |}\right ) \]

[In]

integrate(sec(x)^2/(1-tan(x)^2),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

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

[In]

int(-1/(cos(x)^2*(tan(x)^2 - 1)),x)

[Out]

atanh(tan(x))