3.711 \(\int \frac{\sec ^2(x)}{\sqrt{-4+\tan ^2(x)}} \, dx\)

Optimal. Leaf size=14 \[ \tanh ^{-1}\left (\frac{\tan (x)}{\sqrt{\tan ^2(x)-4}}\right ) \]

[Out]

ArcTanh[Tan[x]/Sqrt[-4 + Tan[x]^2]]

________________________________________________________________________________________

Rubi [A]  time = 0.0444797, antiderivative size = 14, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3675, 217, 206} \[ \tanh ^{-1}\left (\frac{\tan (x)}{\sqrt{\tan ^2(x)-4}}\right ) \]

Antiderivative was successfully verified.

[In]

Int[Sec[x]^2/Sqrt[-4 + Tan[x]^2],x]

[Out]

ArcTanh[Tan[x]/Sqrt[-4 + Tan[x]^2]]

Rule 3675

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])

Rule 217

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 206

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

Rubi steps

\begin{align*} \int \frac{\sec ^2(x)}{\sqrt{-4+\tan ^2(x)}} \, dx &=\operatorname{Subst}\left (\int \frac{1}{\sqrt{-4+x^2}} \, dx,x,\tan (x)\right )\\ &=\operatorname{Subst}\left (\int \frac{1}{1-x^2} \, dx,x,\frac{\tan (x)}{\sqrt{-4+\tan ^2(x)}}\right )\\ &=\tanh ^{-1}\left (\frac{\tan (x)}{\sqrt{-4+\tan ^2(x)}}\right )\\ \end{align*}

Mathematica [B]  time = 0.0518447, size = 46, normalized size = 3.29 \[ \frac{\sqrt{5 \cos (2 x)+3} \sec (x) \tan ^{-1}\left (\frac{\sin (x)}{\sqrt{4-5 \sin ^2(x)}}\right )}{\sqrt{2} \sqrt{\tan ^2(x)-4}} \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]^2/Sqrt[-4 + Tan[x]^2],x]

[Out]

(ArcTan[Sin[x]/Sqrt[4 - 5*Sin[x]^2]]*Sqrt[3 + 5*Cos[2*x]]*Sec[x])/(Sqrt[2]*Sqrt[-4 + Tan[x]^2])

________________________________________________________________________________________

Maple [C]  time = 0.394, size = 173, normalized size = 12.4 \begin{align*}{\frac{\sqrt{2} \left ( \sin \left ( x \right ) \right ) ^{2}}{4\,\sqrt{3/2-1/2\,\sqrt{5}}\cos \left ( x \right ) \left ( -1+\cos \left ( x \right ) \right ) }\sqrt{-2\,{\frac{\cos \left ( x \right ) \sqrt{5}-\sqrt{5}-5\,\cos \left ( x \right ) +1}{1+\cos \left ( x \right ) }}}\sqrt{{\frac{\cos \left ( x \right ) \sqrt{5}-\sqrt{5}+5\,\cos \left ( x \right ) -1}{1+\cos \left ( x \right ) }}} \left ( 2\,{\it EllipticPi} \left ({\frac{\sqrt{3/2-1/2\,\sqrt{5}} \left ( -1+\cos \left ( x \right ) \right ) }{\sin \left ( x \right ) }},-2\, \left ( \sqrt{5}-3 \right ) ^{-1},{\frac{\sqrt{3/2+1/2\,\sqrt{5}}}{\sqrt{3/2-1/2\,\sqrt{5}}}} \right ) -{\it EllipticF} \left ({\frac{ \left ( -1+\cos \left ( x \right ) \right ) \left ( \sqrt{5}-1 \right ) }{2\,\sin \left ( x \right ) }},{\frac{3}{2}}+{\frac{\sqrt{5}}{2}} \right ) \right ){\frac{1}{\sqrt{-{\frac{5\, \left ( \cos \left ( x \right ) \right ) ^{2}-1}{ \left ( \cos \left ( x \right ) \right ) ^{2}}}}}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)^2/(-4+tan(x)^2)^(1/2),x)

[Out]

1/4/(3/2-1/2*5^(1/2))^(1/2)*(-2*(cos(x)*5^(1/2)-5^(1/2)-5*cos(x)+1)/(1+cos(x)))^(1/2)*2^(1/2)*((cos(x)*5^(1/2)
-5^(1/2)+5*cos(x)-1)/(1+cos(x)))^(1/2)*(2*EllipticPi((3/2-1/2*5^(1/2))^(1/2)*(-1+cos(x))/sin(x),-2/(5^(1/2)-3)
,(3/2+1/2*5^(1/2))^(1/2)/(3/2-1/2*5^(1/2))^(1/2))-EllipticF(1/2*(-1+cos(x))*(5^(1/2)-1)/sin(x),3/2+1/2*5^(1/2)
))*sin(x)^2/(-(5*cos(x)^2-1)/cos(x)^2)^(1/2)/cos(x)/(-1+cos(x))

________________________________________________________________________________________

Maxima [A]  time = 0.967429, size = 22, normalized size = 1.57 \begin{align*} \log \left (2 \, \sqrt{\tan \left (x\right )^{2} - 4} + 2 \, \tan \left (x\right )\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(2*sqrt(tan(x)^2 - 4) + 2*tan(x))

________________________________________________________________________________________

Fricas [B]  time = 2.1551, size = 224, normalized size = 16. \begin{align*} \frac{1}{4} \, \log \left (\frac{1}{2} \, \sqrt{-\frac{5 \, \cos \left (x\right )^{2} - 1}{\cos \left (x\right )^{2}}} \cos \left (x\right ) \sin \left (x\right ) - \frac{3}{2} \, \cos \left (x\right )^{2} + \frac{1}{2}\right ) - \frac{1}{4} \, \log \left (-\frac{1}{2} \, \sqrt{-\frac{5 \, \cos \left (x\right )^{2} - 1}{\cos \left (x\right )^{2}}} \cos \left (x\right ) \sin \left (x\right ) - \frac{3}{2} \, \cos \left (x\right )^{2} + \frac{1}{2}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(sec(x)**2/sqrt((tan(x) - 2)*(tan(x) + 2)), x)

________________________________________________________________________________________

Giac [A]  time = 1.17512, size = 23, normalized size = 1.64 \begin{align*} -\log \left ({\left | \sqrt{\tan \left (x\right )^{2} - 4} - \tan \left (x\right ) \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-log(abs(sqrt(tan(x)^2 - 4) - tan(x)))