\(\int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx\) [791]

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

Optimal result

Integrand size = 21, antiderivative size = 103 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=-\frac {\sec ^3(c+d x)}{3 a^3 d}+\frac {\sec ^5(c+d x)}{a^3 d}-\frac {4 \sec ^7(c+d x)}{7 a^3 d}+\frac {\tan ^3(c+d x)}{3 a^3 d}+\frac {\tan ^5(c+d x)}{a^3 d}+\frac {4 \tan ^7(c+d x)}{7 a^3 d} \] Output:

-1/3*sec(d*x+c)^3/a^3/d+sec(d*x+c)^5/a^3/d-4/7*sec(d*x+c)^7/a^3/d+1/3*tan( 
d*x+c)^3/a^3/d+tan(d*x+c)^5/a^3/d+4/7*tan(d*x+c)^7/a^3/d
 

Mathematica [A] (verified)

Time = 1.06 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.01 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=\frac {\sec (c+d x) (336-70 \cos (c+d x)-224 \cos (2 (c+d x))+30 \cos (3 (c+d x))+16 \cos (4 (c+d x))+672 \sin (c+d x)-70 \sin (2 (c+d x))-96 \sin (3 (c+d x))+5 \sin (4 (c+d x)))}{1344 a^3 d (1+\sin (c+d x))^3} \] Input:

Integrate[Tan[c + d*x]^2/(a + a*Sin[c + d*x])^3,x]
 

Output:

(Sec[c + d*x]*(336 - 70*Cos[c + d*x] - 224*Cos[2*(c + d*x)] + 30*Cos[3*(c 
+ d*x)] + 16*Cos[4*(c + d*x)] + 672*Sin[c + d*x] - 70*Sin[2*(c + d*x)] - 9 
6*Sin[3*(c + d*x)] + 5*Sin[4*(c + d*x)]))/(1344*a^3*d*(1 + Sin[c + d*x])^3 
)
 

Rubi [A] (verified)

Time = 0.45 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.04, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 3190, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\tan ^2(c+d x)}{(a \sin (c+d x)+a)^3} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (c+d x)^2}{(a \sin (c+d x)+a)^3}dx\)

\(\Big \downarrow \) 3190

\(\displaystyle \frac {\int \left (a^3 \tan ^2(c+d x) \sec ^6(c+d x)-3 a^3 \tan ^3(c+d x) \sec ^5(c+d x)+3 a^3 \tan ^4(c+d x) \sec ^4(c+d x)-a^3 \tan ^5(c+d x) \sec ^3(c+d x)\right )dx}{a^6}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\frac {4 a^3 \tan ^7(c+d x)}{7 d}+\frac {a^3 \tan ^5(c+d x)}{d}+\frac {a^3 \tan ^3(c+d x)}{3 d}-\frac {4 a^3 \sec ^7(c+d x)}{7 d}+\frac {a^3 \sec ^5(c+d x)}{d}-\frac {a^3 \sec ^3(c+d x)}{3 d}}{a^6}\)

Input:

Int[Tan[c + d*x]^2/(a + a*Sin[c + d*x])^3,x]
 

Output:

(-1/3*(a^3*Sec[c + d*x]^3)/d + (a^3*Sec[c + d*x]^5)/d - (4*a^3*Sec[c + d*x 
]^7)/(7*d) + (a^3*Tan[c + d*x]^3)/(3*d) + (a^3*Tan[c + d*x]^5)/d + (4*a^3* 
Tan[c + d*x]^7)/(7*d))/a^6
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3190
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((g_.)*tan[(e_.) + (f_.)*(x 
_)])^(p_.), x_Symbol] :> Simp[a^(2*m)   Int[ExpandIntegrand[(g*Tan[e + f*x] 
)^p/Sec[e + f*x]^m, (a*Sec[e + f*x] - b*Tan[e + f*x])^(-m), x], x], x] /; F 
reeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && ILtQ[m, 0]
 
Maple [C] (verified)

Result contains complex when optimal does not.

Time = 1.23 (sec) , antiderivative size = 97, normalized size of antiderivative = 0.94

method result size
risch \(-\frac {4 \left (-14 i {\mathrm e}^{2 i \left (d x +c \right )}-28 \,{\mathrm e}^{3 i \left (d x +c \right )}+6 \,{\mathrm e}^{i \left (d x +c \right )}+i+21 i {\mathrm e}^{4 i \left (d x +c \right )}+14 \,{\mathrm e}^{5 i \left (d x +c \right )}\right )}{21 \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )^{7} d \,a^{3}}\) \(97\)
derivativedivides \(\frac {-\frac {1}{8 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {8}{7 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{7}}+\frac {4}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{6}}-\frac {6}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {5}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {13}{6 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{64 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+64}}{a^{3} d}\) \(130\)
default \(\frac {-\frac {1}{8 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {8}{7 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{7}}+\frac {4}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{6}}-\frac {6}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {5}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {13}{6 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{64 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+64}}{a^{3} d}\) \(130\)

Input:

int(tan(d*x+c)^2/(a+a*sin(d*x+c))^3,x,method=_RETURNVERBOSE)
 

Output:

-4/21*(-14*I*exp(2*I*(d*x+c))-28*exp(3*I*(d*x+c))+6*exp(I*(d*x+c))+I+21*I* 
exp(4*I*(d*x+c))+14*exp(5*I*(d*x+c)))/(exp(I*(d*x+c))-I)/(exp(I*(d*x+c))+I 
)^7/d/a^3
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.01 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=-\frac {2 \, \cos \left (d x + c\right )^{4} - 9 \, \cos \left (d x + c\right )^{2} - 6 \, {\left (\cos \left (d x + c\right )^{2} - 2\right )} \sin \left (d x + c\right ) + 9}{21 \, {\left (3 \, a^{3} d \cos \left (d x + c\right )^{3} - 4 \, a^{3} d \cos \left (d x + c\right ) + {\left (a^{3} d \cos \left (d x + c\right )^{3} - 4 \, a^{3} d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )\right )}} \] Input:

integrate(tan(d*x+c)^2/(a+a*sin(d*x+c))^3,x, algorithm="fricas")
 

Output:

-1/21*(2*cos(d*x + c)^4 - 9*cos(d*x + c)^2 - 6*(cos(d*x + c)^2 - 2)*sin(d* 
x + c) + 9)/(3*a^3*d*cos(d*x + c)^3 - 4*a^3*d*cos(d*x + c) + (a^3*d*cos(d* 
x + c)^3 - 4*a^3*d*cos(d*x + c))*sin(d*x + c))
 

Sympy [F]

\[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=\frac {\int \frac {\tan ^{2}{\left (c + d x \right )}}{\sin ^{3}{\left (c + d x \right )} + 3 \sin ^{2}{\left (c + d x \right )} + 3 \sin {\left (c + d x \right )} + 1}\, dx}{a^{3}} \] Input:

integrate(tan(d*x+c)**2/(a+a*sin(d*x+c))**3,x)
 

Output:

Integral(tan(c + d*x)**2/(sin(c + d*x)**3 + 3*sin(c + d*x)**2 + 3*sin(c + 
d*x) + 1), x)/a**3
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 270 vs. \(2 (95) = 190\).

Time = 0.04 (sec) , antiderivative size = 270, normalized size of antiderivative = 2.62 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=\frac {4 \, {\left (\frac {6 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {14 \, \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {28 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {21 \, \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} + \frac {14 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} + 1\right )}}{21 \, {\left (a^{3} + \frac {6 \, a^{3} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {14 \, a^{3} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {14 \, a^{3} \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} - \frac {14 \, a^{3} \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} - \frac {14 \, a^{3} \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}} - \frac {6 \, a^{3} \sin \left (d x + c\right )^{7}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{7}} - \frac {a^{3} \sin \left (d x + c\right )^{8}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{8}}\right )} d} \] Input:

integrate(tan(d*x+c)^2/(a+a*sin(d*x+c))^3,x, algorithm="maxima")
 

Output:

4/21*(6*sin(d*x + c)/(cos(d*x + c) + 1) + 14*sin(d*x + c)^2/(cos(d*x + c) 
+ 1)^2 + 28*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 + 21*sin(d*x + c)^4/(cos(d 
*x + c) + 1)^4 + 14*sin(d*x + c)^5/(cos(d*x + c) + 1)^5 + 1)/((a^3 + 6*a^3 
*sin(d*x + c)/(cos(d*x + c) + 1) + 14*a^3*sin(d*x + c)^2/(cos(d*x + c) + 1 
)^2 + 14*a^3*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 - 14*a^3*sin(d*x + c)^5/( 
cos(d*x + c) + 1)^5 - 14*a^3*sin(d*x + c)^6/(cos(d*x + c) + 1)^6 - 6*a^3*s 
in(d*x + c)^7/(cos(d*x + c) + 1)^7 - a^3*sin(d*x + c)^8/(cos(d*x + c) + 1) 
^8)*d)
 

Giac [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.17 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=-\frac {\frac {21}{a^{3} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}} - \frac {21 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} + 168 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 161 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 224 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 63 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 56 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 11}{a^{3} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{7}}}{168 \, d} \] Input:

integrate(tan(d*x+c)^2/(a+a*sin(d*x+c))^3,x, algorithm="giac")
 

Output:

-1/168*(21/(a^3*(tan(1/2*d*x + 1/2*c) - 1)) - (21*tan(1/2*d*x + 1/2*c)^6 + 
 168*tan(1/2*d*x + 1/2*c)^5 + 161*tan(1/2*d*x + 1/2*c)^4 + 224*tan(1/2*d*x 
 + 1/2*c)^3 + 63*tan(1/2*d*x + 1/2*c)^2 + 56*tan(1/2*d*x + 1/2*c) + 11)/(a 
^3*(tan(1/2*d*x + 1/2*c) + 1)^7))/d
 

Mupad [B] (verification not implemented)

Time = 31.90 (sec) , antiderivative size = 183, normalized size of antiderivative = 1.78 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=\frac {\frac {4\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8}{21}+\frac {8\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{7}+\frac {8\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{3}+\frac {16\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{3}+4\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+\frac {8\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5}{3}}{a^3\,d\,\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,{\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}^7} \] Input:

int(tan(c + d*x)^2/(a + a*sin(c + d*x))^3,x)
 

Output:

((4*cos(c/2 + (d*x)/2)^8)/21 + (8*cos(c/2 + (d*x)/2)^7*sin(c/2 + (d*x)/2)) 
/7 + (8*cos(c/2 + (d*x)/2)^3*sin(c/2 + (d*x)/2)^5)/3 + 4*cos(c/2 + (d*x)/2 
)^4*sin(c/2 + (d*x)/2)^4 + (16*cos(c/2 + (d*x)/2)^5*sin(c/2 + (d*x)/2)^3)/ 
3 + (8*cos(c/2 + (d*x)/2)^6*sin(c/2 + (d*x)/2)^2)/3)/(a^3*d*(cos(c/2 + (d* 
x)/2) - sin(c/2 + (d*x)/2))*(cos(c/2 + (d*x)/2) + sin(c/2 + (d*x)/2))^7)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.36 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^3} \, dx=\frac {2 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3}+6 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2}+6 \cos \left (d x +c \right ) \sin \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \sin \left (d x +c \right )^{4}+6 \sin \left (d x +c \right )^{3}+5 \sin \left (d x +c \right )^{2}+6 \sin \left (d x +c \right )+2}{21 \cos \left (d x +c \right ) a^{3} d \left (\sin \left (d x +c \right )^{3}+3 \sin \left (d x +c \right )^{2}+3 \sin \left (d x +c \right )+1\right )} \] Input:

int(tan(d*x+c)^2/(a+a*sin(d*x+c))^3,x)
 

Output:

(2*cos(c + d*x)*sin(c + d*x)**3 + 6*cos(c + d*x)*sin(c + d*x)**2 + 6*cos(c 
 + d*x)*sin(c + d*x) + 2*cos(c + d*x) + 2*sin(c + d*x)**4 + 6*sin(c + d*x) 
**3 + 5*sin(c + d*x)**2 + 6*sin(c + d*x) + 2)/(21*cos(c + d*x)*a**3*d*(sin 
(c + d*x)**3 + 3*sin(c + d*x)**2 + 3*sin(c + d*x) + 1))