\(\int \frac {1}{(\cos ^2(x)-\sin ^2(x))^3} \, dx\) [477]

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

Optimal result

Integrand size = 13, antiderivative size = 32 \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=\frac {1}{4} \text {arctanh}(2 \cos (x) \sin (x))+\frac {\sec ^2(x) \tan (x)}{2 \left (1-\tan ^2(x)\right )^2} \]

[Out]

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

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {424, 21, 212} \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=\frac {1}{4} \text {arctanh}(2 \sin (x) \cos (x))+\frac {\tan (x) \sec ^2(x)}{2 \left (1-\tan ^2(x)\right )^2} \]

[In]

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

[Out]

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

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

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 424

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[(a*d - c*b)*x*(a + b*x^n)^(
p + 1)*((c + d*x^n)^(q - 1)/(a*b*n*(p + 1))), x] - Dist[1/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1)*(c + d*x^n)
^(q - 2)*Simp[c*(a*d - c*b*(n*(p + 1) + 1)) + d*(a*d*(n*(q - 1) + 1) - b*c*(n*(p + q) + 1))*x^n, x], x], x] /;
 FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && GtQ[q, 1] && IntBinomialQ[a, b, c, d, n, p, q
, x]

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

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.69 \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=\frac {1}{4} \text {arctanh}(\sin (2 x))+\frac {1}{4} \sec (2 x) \tan (2 x) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.50

method result size
default \(-\frac {1}{4 \left (1+\tan \left (x \right )\right )^{2}}+\frac {1}{4+4 \tan \left (x \right )}+\frac {\ln \left (1+\tan \left (x \right )\right )}{4}+\frac {1}{4 \left (\tan \left (x \right )-1\right )^{2}}+\frac {1}{4 \tan \left (x \right )-4}-\frac {\ln \left (\tan \left (x \right )-1\right )}{4}\) \(48\)
risch \(-\frac {i \left ({\mathrm e}^{6 i x}-{\mathrm e}^{2 i x}\right )}{2 \left ({\mathrm e}^{4 i x}+1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{2 i x}-i\right )}{4}+\frac {\ln \left (i+{\mathrm e}^{2 i x}\right )}{4}\) \(49\)
parallelrisch \(\frac {\left (1+\cos \left (4 x \right )\right ) \ln \left (\frac {-\cos \left (x \right )-\sin \left (x \right )}{\cos \left (x \right )+1}\right )+\left (-\cos \left (4 x \right )-1\right ) \ln \left (\frac {-\cos \left (x \right )+\sin \left (x \right )}{\cos \left (x \right )+1}\right )+2 \sin \left (2 x \right )}{4 \cos \left (4 x \right )+4}\) \(67\)
norman \(\frac {\tan \left (\frac {x}{2}\right )^{3}-\tan \left (\frac {x}{2}\right )^{5}-\tan \left (\frac {x}{2}\right )^{7}+\tan \left (\frac {x}{2}\right )}{\left (\tan \left (\frac {x}{2}\right )^{4}-6 \tan \left (\frac {x}{2}\right )^{2}+1\right )^{2}}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )^{2}-2 \tan \left (\frac {x}{2}\right )-1\right )}{4}-\frac {\ln \left (\tan \left (\frac {x}{2}\right )^{2}+2 \tan \left (\frac {x}{2}\right )-1\right )}{4}\) \(82\)

[In]

int(1/(cos(x)^2-sin(x)^2)^3,x,method=_RETURNVERBOSE)

[Out]

-1/4/(1+tan(x))^2+1/4/(1+tan(x))+1/4*ln(1+tan(x))+1/4/(tan(x)-1)^2+1/4/(tan(x)-1)-1/4*ln(tan(x)-1)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (26) = 52\).

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

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

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

Time = 1.61 (sec) , antiderivative size = 765, normalized size of antiderivative = 23.91 \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=\text {Too large to display} \]

[In]

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

[Out]

log(tan(x/2)**2 - 2*tan(x/2) - 1)*tan(x/2)**8/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)*
*2 + 4) - 12*log(tan(x/2)**2 - 2*tan(x/2) - 1)*tan(x/2)**6/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 -
 48*tan(x/2)**2 + 4) + 38*log(tan(x/2)**2 - 2*tan(x/2) - 1)*tan(x/2)**4/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*
tan(x/2)**4 - 48*tan(x/2)**2 + 4) - 12*log(tan(x/2)**2 - 2*tan(x/2) - 1)*tan(x/2)**2/(4*tan(x/2)**8 - 48*tan(x
/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) + log(tan(x/2)**2 - 2*tan(x/2) - 1)/(4*tan(x/2)**8 - 48*tan(x/2
)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) - log(tan(x/2)**2 + 2*tan(x/2) - 1)*tan(x/2)**8/(4*tan(x/2)**8 -
48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) + 12*log(tan(x/2)**2 + 2*tan(x/2) - 1)*tan(x/2)**6/(4*t
an(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) - 38*log(tan(x/2)**2 + 2*tan(x/2) - 1)*tan
(x/2)**4/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) + 12*log(tan(x/2)**2 + 2*tan(
x/2) - 1)*tan(x/2)**2/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) - log(tan(x/2)**
2 + 2*tan(x/2) - 1)/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) - 4*tan(x/2)**7/(4
*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) - 4*tan(x/2)**5/(4*tan(x/2)**8 - 48*tan(
x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4) + 4*tan(x/2)**3/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)
**4 - 48*tan(x/2)**2 + 4) + 4*tan(x/2)/(4*tan(x/2)**8 - 48*tan(x/2)**6 + 152*tan(x/2)**4 - 48*tan(x/2)**2 + 4)

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.16 \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=-\frac {\sin \left (2 \, x\right )}{4 \, {\left (\sin \left (2 \, x\right )^{2} - 1\right )}} + \frac {1}{8} \, \log \left (\sin \left (2 \, x\right ) + 1\right ) - \frac {1}{8} \, \log \left (-\sin \left (2 \, x\right ) + 1\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 27.57 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00 \[ \int \frac {1}{\left (\cos ^2(x)-\sin ^2(x)\right )^3} \, dx=\frac {\mathrm {atanh}\left (\mathrm {tan}\left (x\right )\right )}{2}+\frac {\frac {{\mathrm {tan}\left (x\right )}^3}{2}+\frac {\mathrm {tan}\left (x\right )}{2}}{{\mathrm {tan}\left (x\right )}^4-2\,{\mathrm {tan}\left (x\right )}^2+1} \]

[In]

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

[Out]

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