\(\int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx\) [82]

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

Optimal result

Integrand size = 24, antiderivative size = 133 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=-192 a^8 x+\frac {192 i a^8 \log (\cos (c+d x))}{d}+\frac {129 a^8 \tan (c+d x)}{d}+\frac {36 i a^8 \tan ^2(c+d x)}{d}-\frac {10 a^8 \tan ^3(c+d x)}{d}-\frac {2 i a^8 \tan ^4(c+d x)}{d}+\frac {a^8 \tan ^5(c+d x)}{5 d}-\frac {64 i a^9}{d (a-i a \tan (c+d x))} \] Output:

-192*a^8*x+192*I*a^8*ln(cos(d*x+c))/d+129*a^8*tan(d*x+c)/d+36*I*a^8*tan(d* 
x+c)^2/d-10*a^8*tan(d*x+c)^3/d-2*I*a^8*tan(d*x+c)^4/d+1/5*a^8*tan(d*x+c)^5 
/d-64*I*a^9/d/(a-I*a*tan(d*x+c))
 

Mathematica [A] (verified)

Time = 0.81 (sec) , antiderivative size = 96, normalized size of antiderivative = 0.72 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=-\frac {i a^8 \left (960 \log (i+\tan (c+d x))+645 i \tan (c+d x)-180 \tan ^2(c+d x)-50 i \tan ^3(c+d x)+10 \tan ^4(c+d x)+i \tan ^5(c+d x)+\frac {320 i}{i+\tan (c+d x)}\right )}{5 d} \] Input:

Integrate[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^8,x]
 

Output:

((-1/5*I)*a^8*(960*Log[I + Tan[c + d*x]] + (645*I)*Tan[c + d*x] - 180*Tan[ 
c + d*x]^2 - (50*I)*Tan[c + d*x]^3 + 10*Tan[c + d*x]^4 + I*Tan[c + d*x]^5 
+ (320*I)/(I + Tan[c + d*x])))/d
 

Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 121, normalized size of antiderivative = 0.91, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3042, 3968, 49, 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 \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+i a \tan (c+d x))^8}{\sec (c+d x)^2}dx\)

\(\Big \downarrow \) 3968

\(\displaystyle -\frac {i a^3 \int \frac {(i \tan (c+d x) a+a)^6}{(a-i a \tan (c+d x))^2}d(i a \tan (c+d x))}{d}\)

\(\Big \downarrow \) 49

\(\displaystyle -\frac {i a^3 \int \left (\frac {64 a^6}{(a-i a \tan (c+d x))^2}-\frac {192 a^5}{a-i a \tan (c+d x)}+\tan ^4(c+d x) a^4-8 i \tan ^3(c+d x) a^4-30 \tan ^2(c+d x) a^4+72 i \tan (c+d x) a^4+129 a^4\right )d(i a \tan (c+d x))}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {i a^3 \left (\frac {64 a^6}{a-i a \tan (c+d x)}+\frac {1}{5} i a^5 \tan ^5(c+d x)+2 a^5 \tan ^4(c+d x)-10 i a^5 \tan ^3(c+d x)-36 a^5 \tan ^2(c+d x)+129 i a^5 \tan (c+d x)+192 a^5 \log (a-i a \tan (c+d x))\right )}{d}\)

Input:

Int[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^8,x]
 

Output:

((-I)*a^3*(192*a^5*Log[a - I*a*Tan[c + d*x]] + (129*I)*a^5*Tan[c + d*x] - 
36*a^5*Tan[c + d*x]^2 - (10*I)*a^5*Tan[c + d*x]^3 + 2*a^5*Tan[c + d*x]^4 + 
 (I/5)*a^5*Tan[c + d*x]^5 + (64*a^6)/(a - I*a*Tan[c + d*x])))/d
 

Defintions of rubi rules used

rule 49
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}, x] 
&& IGtQ[m, 0] && IGtQ[m + n + 2, 0]
 

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 3968
Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ 
), x_Symbol] :> Simp[1/(a^(m - 2)*b*f)   Subst[Int[(a - x)^(m/2 - 1)*(a + x 
)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && 
 EqQ[a^2 + b^2, 0] && IntegerQ[m/2]
 
Maple [A] (verified)

Time = 75.78 (sec) , antiderivative size = 118, normalized size of antiderivative = 0.89

method result size
risch \(-\frac {32 i a^{8} {\mathrm e}^{2 i \left (d x +c \right )}}{d}+\frac {384 a^{8} c}{d}+\frac {16 i a^{8} \left (150 \,{\mathrm e}^{8 i \left (d x +c \right )}+500 \,{\mathrm e}^{6 i \left (d x +c \right )}+650 \,{\mathrm e}^{4 i \left (d x +c \right )}+385 \,{\mathrm e}^{2 i \left (d x +c \right )}+87\right )}{5 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+\frac {192 i a^{8} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(118\)
derivativedivides \(\frac {a^{8} \left (\frac {\sin \left (d x +c \right )^{9}}{5 \cos \left (d x +c \right )^{5}}-\frac {4 \sin \left (d x +c \right )^{9}}{15 \cos \left (d x +c \right )^{3}}+\frac {8 \sin \left (d x +c \right )^{9}}{5 \cos \left (d x +c \right )}+\frac {8 \left (\sin \left (d x +c \right )^{7}+\frac {7 \sin \left (d x +c \right )^{5}}{6}+\frac {35 \sin \left (d x +c \right )^{3}}{24}+\frac {35 \sin \left (d x +c \right )}{16}\right ) \cos \left (d x +c \right )}{5}-\frac {7 d x}{2}-\frac {7 c}{2}\right )-8 i a^{8} \left (\frac {\sin \left (d x +c \right )^{8}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{8}}{2 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{6}}{2}-\frac {3 \sin \left (d x +c \right )^{4}}{4}-\frac {3 \sin \left (d x +c \right )^{2}}{2}-3 \ln \left (\cos \left (d x +c \right )\right )\right )-28 a^{8} \left (\frac {\sin \left (d x +c \right )^{7}}{3 \cos \left (d x +c \right )^{3}}-\frac {4 \sin \left (d x +c \right )^{7}}{3 \cos \left (d x +c \right )}-\frac {4 \left (\sin \left (d x +c \right )^{5}+\frac {5 \sin \left (d x +c \right )^{3}}{4}+\frac {15 \sin \left (d x +c \right )}{8}\right ) \cos \left (d x +c \right )}{3}+\frac {5 d x}{2}+\frac {5 c}{2}\right )-56 i a^{8} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+70 a^{8} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+56 i a^{8} \left (\frac {\sin \left (d x +c \right )^{6}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )^{4}}{2}+\sin \left (d x +c \right )^{2}+2 \ln \left (\cos \left (d x +c \right )\right )\right )-28 a^{8} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-4 i a^{8} \cos \left (d x +c \right )^{2}+a^{8} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(482\)
default \(\frac {a^{8} \left (\frac {\sin \left (d x +c \right )^{9}}{5 \cos \left (d x +c \right )^{5}}-\frac {4 \sin \left (d x +c \right )^{9}}{15 \cos \left (d x +c \right )^{3}}+\frac {8 \sin \left (d x +c \right )^{9}}{5 \cos \left (d x +c \right )}+\frac {8 \left (\sin \left (d x +c \right )^{7}+\frac {7 \sin \left (d x +c \right )^{5}}{6}+\frac {35 \sin \left (d x +c \right )^{3}}{24}+\frac {35 \sin \left (d x +c \right )}{16}\right ) \cos \left (d x +c \right )}{5}-\frac {7 d x}{2}-\frac {7 c}{2}\right )-8 i a^{8} \left (\frac {\sin \left (d x +c \right )^{8}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{8}}{2 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{6}}{2}-\frac {3 \sin \left (d x +c \right )^{4}}{4}-\frac {3 \sin \left (d x +c \right )^{2}}{2}-3 \ln \left (\cos \left (d x +c \right )\right )\right )-28 a^{8} \left (\frac {\sin \left (d x +c \right )^{7}}{3 \cos \left (d x +c \right )^{3}}-\frac {4 \sin \left (d x +c \right )^{7}}{3 \cos \left (d x +c \right )}-\frac {4 \left (\sin \left (d x +c \right )^{5}+\frac {5 \sin \left (d x +c \right )^{3}}{4}+\frac {15 \sin \left (d x +c \right )}{8}\right ) \cos \left (d x +c \right )}{3}+\frac {5 d x}{2}+\frac {5 c}{2}\right )-56 i a^{8} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+70 a^{8} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+56 i a^{8} \left (\frac {\sin \left (d x +c \right )^{6}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )^{4}}{2}+\sin \left (d x +c \right )^{2}+2 \ln \left (\cos \left (d x +c \right )\right )\right )-28 a^{8} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-4 i a^{8} \cos \left (d x +c \right )^{2}+a^{8} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(482\)

Input:

int(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^8,x,method=_RETURNVERBOSE)
 

Output:

-32*I/d*a^8*exp(2*I*(d*x+c))+384/d*a^8*c+16/5*I*a^8*(150*exp(8*I*(d*x+c))+ 
500*exp(6*I*(d*x+c))+650*exp(4*I*(d*x+c))+385*exp(2*I*(d*x+c))+87)/d/(exp( 
2*I*(d*x+c))+1)^5+192*I/d*a^8*ln(exp(2*I*(d*x+c))+1)
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 245 vs. \(2 (121) = 242\).

Time = 0.09 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.84 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=-\frac {16 \, {\left (10 i \, a^{8} e^{\left (12 i \, d x + 12 i \, c\right )} + 50 i \, a^{8} e^{\left (10 i \, d x + 10 i \, c\right )} - 50 i \, a^{8} e^{\left (8 i \, d x + 8 i \, c\right )} - 400 i \, a^{8} e^{\left (6 i \, d x + 6 i \, c\right )} - 600 i \, a^{8} e^{\left (4 i \, d x + 4 i \, c\right )} - 375 i \, a^{8} e^{\left (2 i \, d x + 2 i \, c\right )} - 87 i \, a^{8} + 60 \, {\left (-i \, a^{8} e^{\left (10 i \, d x + 10 i \, c\right )} - 5 i \, a^{8} e^{\left (8 i \, d x + 8 i \, c\right )} - 10 i \, a^{8} e^{\left (6 i \, d x + 6 i \, c\right )} - 10 i \, a^{8} e^{\left (4 i \, d x + 4 i \, c\right )} - 5 i \, a^{8} e^{\left (2 i \, d x + 2 i \, c\right )} - i \, a^{8}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{5 \, {\left (d e^{\left (10 i \, d x + 10 i \, c\right )} + 5 \, d e^{\left (8 i \, d x + 8 i \, c\right )} + 10 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 10 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 5 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \] Input:

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^8,x, algorithm="fricas")
 

Output:

-16/5*(10*I*a^8*e^(12*I*d*x + 12*I*c) + 50*I*a^8*e^(10*I*d*x + 10*I*c) - 5 
0*I*a^8*e^(8*I*d*x + 8*I*c) - 400*I*a^8*e^(6*I*d*x + 6*I*c) - 600*I*a^8*e^ 
(4*I*d*x + 4*I*c) - 375*I*a^8*e^(2*I*d*x + 2*I*c) - 87*I*a^8 + 60*(-I*a^8* 
e^(10*I*d*x + 10*I*c) - 5*I*a^8*e^(8*I*d*x + 8*I*c) - 10*I*a^8*e^(6*I*d*x 
+ 6*I*c) - 10*I*a^8*e^(4*I*d*x + 4*I*c) - 5*I*a^8*e^(2*I*d*x + 2*I*c) - I* 
a^8)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(10*I*d*x + 10*I*c) + 5*d*e^(8*I*d 
*x + 8*I*c) + 10*d*e^(6*I*d*x + 6*I*c) + 10*d*e^(4*I*d*x + 4*I*c) + 5*d*e^ 
(2*I*d*x + 2*I*c) + d)
 

Sympy [A] (verification not implemented)

Time = 0.39 (sec) , antiderivative size = 257, normalized size of antiderivative = 1.93 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=\frac {192 i a^{8} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {2400 i a^{8} e^{8 i c} e^{8 i d x} + 8000 i a^{8} e^{6 i c} e^{6 i d x} + 10400 i a^{8} e^{4 i c} e^{4 i d x} + 6160 i a^{8} e^{2 i c} e^{2 i d x} + 1392 i a^{8}}{5 d e^{10 i c} e^{10 i d x} + 25 d e^{8 i c} e^{8 i d x} + 50 d e^{6 i c} e^{6 i d x} + 50 d e^{4 i c} e^{4 i d x} + 25 d e^{2 i c} e^{2 i d x} + 5 d} + \begin {cases} - \frac {32 i a^{8} e^{2 i c} e^{2 i d x}}{d} & \text {for}\: d \neq 0 \\64 a^{8} x e^{2 i c} & \text {otherwise} \end {cases} \] Input:

integrate(cos(d*x+c)**2*(a+I*a*tan(d*x+c))**8,x)
 

Output:

192*I*a**8*log(exp(2*I*d*x) + exp(-2*I*c))/d + (2400*I*a**8*exp(8*I*c)*exp 
(8*I*d*x) + 8000*I*a**8*exp(6*I*c)*exp(6*I*d*x) + 10400*I*a**8*exp(4*I*c)* 
exp(4*I*d*x) + 6160*I*a**8*exp(2*I*c)*exp(2*I*d*x) + 1392*I*a**8)/(5*d*exp 
(10*I*c)*exp(10*I*d*x) + 25*d*exp(8*I*c)*exp(8*I*d*x) + 50*d*exp(6*I*c)*ex 
p(6*I*d*x) + 50*d*exp(4*I*c)*exp(4*I*d*x) + 25*d*exp(2*I*c)*exp(2*I*d*x) + 
 5*d) + Piecewise((-32*I*a**8*exp(2*I*c)*exp(2*I*d*x)/d, Ne(d, 0)), (64*a* 
*8*x*exp(2*I*c), True))
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 124, normalized size of antiderivative = 0.93 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=\frac {a^{8} \tan \left (d x + c\right )^{5} - 10 i \, a^{8} \tan \left (d x + c\right )^{4} - 50 \, a^{8} \tan \left (d x + c\right )^{3} + 180 i \, a^{8} \tan \left (d x + c\right )^{2} - 960 \, {\left (d x + c\right )} a^{8} - 480 i \, a^{8} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 645 \, a^{8} \tan \left (d x + c\right ) + \frac {320 \, {\left (a^{8} \tan \left (d x + c\right ) - i \, a^{8}\right )}}{\tan \left (d x + c\right )^{2} + 1}}{5 \, d} \] Input:

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^8,x, algorithm="maxima")
 

Output:

1/5*(a^8*tan(d*x + c)^5 - 10*I*a^8*tan(d*x + c)^4 - 50*a^8*tan(d*x + c)^3 
+ 180*I*a^8*tan(d*x + c)^2 - 960*(d*x + c)*a^8 - 480*I*a^8*log(tan(d*x + c 
)^2 + 1) + 645*a^8*tan(d*x + c) + 320*(a^8*tan(d*x + c) - I*a^8)/(tan(d*x 
+ c)^2 + 1))/d
 

Giac [A] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 119, normalized size of antiderivative = 0.89 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=-\frac {192 i \, a^{8} \log \left (\tan \left (d x + c\right ) + i\right )}{d} + \frac {64 \, a^{8}}{d {\left (\tan \left (d x + c\right ) + i\right )}} + \frac {a^{8} d^{4} \tan \left (d x + c\right )^{5} - 10 i \, a^{8} d^{4} \tan \left (d x + c\right )^{4} - 50 \, a^{8} d^{4} \tan \left (d x + c\right )^{3} + 180 i \, a^{8} d^{4} \tan \left (d x + c\right )^{2} + 645 \, a^{8} d^{4} \tan \left (d x + c\right )}{5 \, d^{5}} \] Input:

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^8,x, algorithm="giac")
 

Output:

-192*I*a^8*log(tan(d*x + c) + I)/d + 64*a^8/(d*(tan(d*x + c) + I)) + 1/5*( 
a^8*d^4*tan(d*x + c)^5 - 10*I*a^8*d^4*tan(d*x + c)^4 - 50*a^8*d^4*tan(d*x 
+ c)^3 + 180*I*a^8*d^4*tan(d*x + c)^2 + 645*a^8*d^4*tan(d*x + c))/d^5
 

Mupad [B] (verification not implemented)

Time = 0.41 (sec) , antiderivative size = 102, normalized size of antiderivative = 0.77 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=\frac {\frac {64\,a^8}{\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}}+129\,a^8\,\mathrm {tan}\left (c+d\,x\right )-10\,a^8\,{\mathrm {tan}\left (c+d\,x\right )}^3+\frac {a^8\,{\mathrm {tan}\left (c+d\,x\right )}^5}{5}-a^8\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,192{}\mathrm {i}+a^8\,{\mathrm {tan}\left (c+d\,x\right )}^2\,36{}\mathrm {i}-a^8\,{\mathrm {tan}\left (c+d\,x\right )}^4\,2{}\mathrm {i}}{d} \] Input:

int(cos(c + d*x)^2*(a + a*tan(c + d*x)*1i)^8,x)
 

Output:

((64*a^8)/(tan(c + d*x) + 1i) - a^8*log(tan(c + d*x) + 1i)*192i + 129*a^8* 
tan(c + d*x) + a^8*tan(c + d*x)^2*36i - 10*a^8*tan(c + d*x)^3 - a^8*tan(c 
+ d*x)^4*2i + (a^8*tan(c + d*x)^5)/5)/d
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 460, normalized size of antiderivative = 3.46 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^8 \, dx=\frac {a^{8} \left (-960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right )^{4} i +1920 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right )^{2} i -960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) i +960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right )^{4} i -1920 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right )^{2} i +960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) i +960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right )^{4} i -1920 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right )^{2} i +960 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) i +320 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{6} i -960 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} c -960 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} d x -830 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} i +1920 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} c +1920 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} d x +500 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} i -960 \cos \left (d x +c \right ) c -960 \cos \left (d x +c \right ) d x -320 \sin \left (d x +c \right )^{7}+1656 \sin \left (d x +c \right )^{5}-2300 \sin \left (d x +c \right )^{3}+965 \sin \left (d x +c \right )\right )}{5 \cos \left (d x +c \right ) d \left (\sin \left (d x +c \right )^{4}-2 \sin \left (d x +c \right )^{2}+1\right )} \] Input:

int(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^8,x)
 

Output:

(a**8*( - 960*cos(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**4*i 
+ 1920*cos(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*i - 960*c 
os(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*i + 960*cos(c + d*x)*log(tan((c + 
 d*x)/2) - 1)*sin(c + d*x)**4*i - 1920*cos(c + d*x)*log(tan((c + d*x)/2) - 
 1)*sin(c + d*x)**2*i + 960*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*i + 960 
*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**4*i - 1920*cos(c + d 
*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*i + 960*cos(c + d*x)*log(tan 
((c + d*x)/2) + 1)*i + 320*cos(c + d*x)*sin(c + d*x)**6*i - 960*cos(c + d* 
x)*sin(c + d*x)**4*c - 960*cos(c + d*x)*sin(c + d*x)**4*d*x - 830*cos(c + 
d*x)*sin(c + d*x)**4*i + 1920*cos(c + d*x)*sin(c + d*x)**2*c + 1920*cos(c 
+ d*x)*sin(c + d*x)**2*d*x + 500*cos(c + d*x)*sin(c + d*x)**2*i - 960*cos( 
c + d*x)*c - 960*cos(c + d*x)*d*x - 320*sin(c + d*x)**7 + 1656*sin(c + d*x 
)**5 - 2300*sin(c + d*x)**3 + 965*sin(c + d*x)))/(5*cos(c + d*x)*d*(sin(c 
+ d*x)**4 - 2*sin(c + d*x)**2 + 1))