\(\int \frac {1}{(\sec (x)+\tan (x))^3} \, dx\) [280]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (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 \frac {1}{(\sec (x)+\tan (x))^3} \, dx=-\log (1+\sin (x))-\frac {2}{1+\sin (x)} \]

[Out]

-ln(1+sin(x))-2/(1+sin(x))

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 16, 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.429, Rules used = {4476, 2746, 45} \[ \int \frac {1}{(\sec (x)+\tan (x))^3} \, dx=-\frac {2}{\sin (x)+1}-\log (\sin (x)+1) \]

[In]

Int[(Sec[x] + Tan[x])^(-3),x]

[Out]

-Log[1 + Sin[x]] - 2/(1 + Sin[x])

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rule 4476

Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x_)]^(n_.))^(p_), x_Symbol] :> Int[A
ctivateTrig[u]*Sec[c + d*x]^(n*p)*(b + a*Sin[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(34\) vs. \(2(16)=32\).

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

[In]

Integrate[(Sec[x] + Tan[x])^(-3),x]

[Out]

-2*Log[Cos[x/2] + Sin[x/2]] - 2/(Cos[x/2] + Sin[x/2])^2

Maple [A] (verified)

Time = 1.14 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06

method result size
default \(-\ln \left (1+\sin \left (x \right )\right )-\frac {2}{1+\sin \left (x \right )}\) \(17\)
risch \(i x -\frac {4 i {\mathrm e}^{i x}}{\left (i+{\mathrm e}^{i x}\right )^{2}}-2 \ln \left (i+{\mathrm e}^{i x}\right )\) \(35\)

[In]

int(1/(sec(x)+tan(x))^3,x,method=_RETURNVERBOSE)

[Out]

-ln(1+sin(x))-2/(1+sin(x))

Fricas [A] (verification not implemented)

none

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

[In]

integrate(1/(sec(x)+tan(x))^3,x, algorithm="fricas")

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 301 vs. \(2 (14) = 28\).

Time = 0.46 (sec) , antiderivative size = 301, normalized size of antiderivative = 18.81 \[ \int \frac {1}{(\sec (x)+\tan (x))^3} \, dx=- \frac {2 \log {\left (\tan {\left (x \right )} + \sec {\left (x \right )} \right )} \tan ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} - \frac {4 \log {\left (\tan {\left (x \right )} + \sec {\left (x \right )} \right )} \tan {\left (x \right )} \sec {\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} - \frac {2 \log {\left (\tan {\left (x \right )} + \sec {\left (x \right )} \right )} \sec ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} + \frac {\log {\left (\tan ^{2}{\left (x \right )} + 1 \right )} \tan ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} + \frac {2 \log {\left (\tan ^{2}{\left (x \right )} + 1 \right )} \tan {\left (x \right )} \sec {\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} + \frac {\log {\left (\tan ^{2}{\left (x \right )} + 1 \right )} \sec ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} + \frac {\tan ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} - \frac {\sec ^{2}{\left (x \right )}}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} - \frac {1}{2 \tan ^{2}{\left (x \right )} + 4 \tan {\left (x \right )} \sec {\left (x \right )} + 2 \sec ^{2}{\left (x \right )}} \]

[In]

integrate(1/(sec(x)+tan(x))**3,x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 64 vs. \(2 (16) = 32\).

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

[In]

integrate(1/(sec(x)+tan(x))^3,x, algorithm="maxima")

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 45 vs. \(2 (16) = 32\).

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

[In]

integrate(1/(sec(x)+tan(x))^3,x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 30.53 (sec) , antiderivative size = 41, normalized size of antiderivative = 2.56 \[ \int \frac {1}{(\sec (x)+\tan (x))^3} \, dx=\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )-2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1\right )+\frac {4\,\mathrm {tan}\left (\frac {x}{2}\right )}{{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,\mathrm {tan}\left (\frac {x}{2}\right )+1} \]

[In]

int(1/(tan(x) + 1/cos(x))^3,x)

[Out]

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