3.475 \(\int \frac {1}{\cos ^2(x)-\sin ^2(x)} \, dx\)

Optimal. Leaf size=11 \[ \frac {1}{2} \tanh ^{-1}(2 \sin (x) \cos (x)) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {206} \[ \frac {1}{2} \tanh ^{-1}(2 \sin (x) \cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[(Cos[x]^2 - Sin[x]^2)^(-1),x]

[Out]

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

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 {1}{\cos ^2(x)-\sin ^2(x)} \, dx &=\operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\tan (x)\right )\\ &=\frac {1}{2} \tanh ^{-1}(2 \cos (x) \sin (x))\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 0.01, size = 23, normalized size = 2.09 \[ \frac {1}{2} \log (\sin (x)+\cos (x))-\frac {1}{2} \log (\cos (x)-\sin (x)) \]

Antiderivative was successfully verified.

[In]

Integrate[(Cos[x]^2 - Sin[x]^2)^(-1),x]

[Out]

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

________________________________________________________________________________________

fricas [B]  time = 0.85, size = 23, normalized size = 2.09 \[ \frac {1}{4} \, \log \left (2 \, \cos \relax (x) \sin \relax (x) + 1\right ) - \frac {1}{4} \, \log \left (-2 \, \cos \relax (x) \sin \relax (x) + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(cos(x)^2-sin(x)^2),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

giac [B]  time = 0.13, size = 33, normalized size = 3.00 \[ \frac {1}{8} \, \log \left ({\left | \frac {1}{\sin \left (2 \, x\right )} + \sin \left (2 \, x\right ) + 2 \right |}\right ) - \frac {1}{8} \, \log \left ({\left | \frac {1}{\sin \left (2 \, x\right )} + \sin \left (2 \, x\right ) - 2 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(cos(x)^2-sin(x)^2),x, algorithm="giac")

[Out]

1/8*log(abs(1/sin(2*x) + sin(2*x) + 2)) - 1/8*log(abs(1/sin(2*x) + sin(2*x) - 2))

________________________________________________________________________________________

maple [A]  time = 0.10, size = 4, normalized size = 0.36 \[ \arctanh \left (\tan \relax (x )\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(cos(x)^2-sin(x)^2),x)

[Out]

arctanh(tan(x))

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 15, normalized size = 1.36 \[ \frac {1}{2} \, \log \left (\tan \relax (x) + 1\right ) - \frac {1}{2} \, \log \left (\tan \relax (x) - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(cos(x)^2-sin(x)^2),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 2.90, size = 3, normalized size = 0.27 \[ \mathrm {atanh}\left (\mathrm {tan}\relax (x)\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(cos(x)^2 - sin(x)^2),x)

[Out]

atanh(tan(x))

________________________________________________________________________________________

sympy [B]  time = 0.35, size = 36, normalized size = 3.27 \[ \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} - 2 \tan {\left (\frac {x}{2} \right )} - 1 \right )}}{2} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 2 \tan {\left (\frac {x}{2} \right )} - 1 \right )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(cos(x)**2-sin(x)**2),x)

[Out]

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

________________________________________________________________________________________