\(\int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx\) [1071]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (warning: unable to verify)
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)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 153 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=4 a^3 (c-i d)^2 x-\frac {4 i a^3 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac {2 a^3 (c-i d)^2 \tan (e+f x)}{f}+\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f} \] Output:

4*a^3*(c-I*d)^2*x-4*I*a^3*(c-I*d)^2*ln(cos(f*x+e))/f-2*a^3*(c-I*d)^2*tan(f 
*x+e)/f+1/2*I*a*(c-I*d)^2*(a+I*a*tan(f*x+e))^2/f+2/3*c*d*(a+I*a*tan(f*x+e) 
)^3/f-1/4*I*d^2*(a+I*a*tan(f*x+e))^4/a/f
 

Mathematica [A] (verified)

Time = 1.03 (sec) , antiderivative size = 99, normalized size of antiderivative = 0.65 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {-3 i a^3 d^2 (-i+\tan (e+f x))^4+8 c d (a+i a \tan (e+f x))^3+6 i a^3 (c-i d)^2 \left (8 \log (i+\tan (e+f x))+6 i \tan (e+f x)-\tan ^2(e+f x)\right )}{12 f} \] Input:

Integrate[(a + I*a*Tan[e + f*x])^3*(c + d*Tan[e + f*x])^2,x]
 

Output:

((-3*I)*a^3*d^2*(-I + Tan[e + f*x])^4 + 8*c*d*(a + I*a*Tan[e + f*x])^3 + ( 
6*I)*a^3*(c - I*d)^2*(8*Log[I + Tan[e + f*x]] + (6*I)*Tan[e + f*x] - Tan[e 
 + f*x]^2))/(12*f)
 

Rubi [A] (verified)

Time = 0.67 (sec) , antiderivative size = 132, normalized size of antiderivative = 0.86, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3042, 4026, 3042, 4010, 3042, 3959, 3042, 3958, 3042, 3956}

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 (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2dx\)

\(\Big \downarrow \) 4026

\(\displaystyle \int (i \tan (e+f x) a+a)^3 \left (c^2+2 d \tan (e+f x) c-d^2\right )dx-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (i \tan (e+f x) a+a)^3 \left (c^2+2 d \tan (e+f x) c-d^2\right )dx-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 4010

\(\displaystyle (c-i d)^2 \int (i \tan (e+f x) a+a)^3dx+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3042

\(\displaystyle (c-i d)^2 \int (i \tan (e+f x) a+a)^3dx+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3959

\(\displaystyle (c-i d)^2 \left (2 a \int (i \tan (e+f x) a+a)^2dx+\frac {i a (a+i a \tan (e+f x))^2}{2 f}\right )+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3042

\(\displaystyle (c-i d)^2 \left (2 a \int (i \tan (e+f x) a+a)^2dx+\frac {i a (a+i a \tan (e+f x))^2}{2 f}\right )+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3958

\(\displaystyle (c-i d)^2 \left (2 a \left (2 i a^2 \int \tan (e+f x)dx-\frac {a^2 \tan (e+f x)}{f}+2 a^2 x\right )+\frac {i a (a+i a \tan (e+f x))^2}{2 f}\right )+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3042

\(\displaystyle (c-i d)^2 \left (2 a \left (2 i a^2 \int \tan (e+f x)dx-\frac {a^2 \tan (e+f x)}{f}+2 a^2 x\right )+\frac {i a (a+i a \tan (e+f x))^2}{2 f}\right )+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

\(\Big \downarrow \) 3956

\(\displaystyle (c-i d)^2 \left (2 a \left (-\frac {a^2 \tan (e+f x)}{f}-\frac {2 i a^2 \log (\cos (e+f x))}{f}+2 a^2 x\right )+\frac {i a (a+i a \tan (e+f x))^2}{2 f}\right )+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\)

Input:

Int[(a + I*a*Tan[e + f*x])^3*(c + d*Tan[e + f*x])^2,x]
 

Output:

(2*c*d*(a + I*a*Tan[e + f*x])^3)/(3*f) - ((I/4)*d^2*(a + I*a*Tan[e + f*x]) 
^4)/(a*f) + (c - I*d)^2*(((I/2)*a*(a + I*a*Tan[e + f*x])^2)/f + 2*a*(2*a^2 
*x - ((2*I)*a^2*Log[Cos[e + f*x]])/f - (a^2*Tan[e + f*x])/f))
 

Defintions of rubi rules used

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

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 3958
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2) 
*x, x] + (Simp[b^2*(Tan[c + d*x]/d), x] + Simp[2*a*b   Int[Tan[c + d*x], x] 
, x]) /; FreeQ[{a, b, c, d}, x]
 

rule 3959
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + 
b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] + Simp[2*a   Int[(a + b*Tan[c + d* 
x])^(n - 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && GtQ[n 
, 1]
 

rule 4010
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Simp 
[(b*c + a*d)/b   Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e 
, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]
 

rule 4026
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( 
m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* 
x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ 
[m, -1] &&  !(EqQ[m, 2] && EqQ[a, 0])
 
Maple [A] (warning: unable to verify)

Time = 0.22 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.15

method result size
derivativedivides \(\frac {a^{3} \left (-\frac {i d^{2} \tan \left (f x +e \right )^{4}}{4}-\frac {2 i c d \tan \left (f x +e \right )^{3}}{3}-\frac {i c^{2} \tan \left (f x +e \right )^{2}}{2}+2 i d^{2} \tan \left (f x +e \right )^{2}-d^{2} \tan \left (f x +e \right )^{3}+8 i \tan \left (f x +e \right ) c d -3 c d \tan \left (f x +e \right )^{2}-3 c^{2} \tan \left (f x +e \right )+4 d^{2} \tan \left (f x +e \right )+\frac {\left (4 i c^{2}-4 i d^{2}+8 c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-8 i c d +4 c^{2}-4 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(176\)
default \(\frac {a^{3} \left (-\frac {i d^{2} \tan \left (f x +e \right )^{4}}{4}-\frac {2 i c d \tan \left (f x +e \right )^{3}}{3}-\frac {i c^{2} \tan \left (f x +e \right )^{2}}{2}+2 i d^{2} \tan \left (f x +e \right )^{2}-d^{2} \tan \left (f x +e \right )^{3}+8 i \tan \left (f x +e \right ) c d -3 c d \tan \left (f x +e \right )^{2}-3 c^{2} \tan \left (f x +e \right )+4 d^{2} \tan \left (f x +e \right )+\frac {\left (4 i c^{2}-4 i d^{2}+8 c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-8 i c d +4 c^{2}-4 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(176\)
norman \(\left (-8 i a^{3} c d +4 a^{3} c^{2}-4 a^{3} d^{2}\right ) x -\frac {\left (2 i a^{3} c d +3 a^{3} d^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}-\frac {\left (-8 i a^{3} c d +3 a^{3} c^{2}-4 a^{3} d^{2}\right ) \tan \left (f x +e \right )}{f}-\frac {i a^{3} d^{2} \tan \left (f x +e \right )^{4}}{4 f}+\frac {i a^{3} \left (6 i c d -c^{2}+4 d^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {2 i a^{3} \left (-2 i c d +c^{2}-d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f}\) \(182\)
parts \(a^{3} c^{2} x +\frac {\left (3 i a^{3} c^{2}+2 a^{3} c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (-2 i a^{3} c d -3 a^{3} d^{2}\right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (-i a^{3} c^{2}+3 i a^{3} d^{2}-6 a^{3} c d \right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (6 i a^{3} c d -3 a^{3} c^{2}+a^{3} d^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {i a^{3} d^{2} \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) \(234\)
parallelrisch \(\frac {24 i \tan \left (f x +e \right )^{2} a^{3} d^{2}+96 i \tan \left (f x +e \right ) a^{3} c d +24 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c^{2}-8 i \tan \left (f x +e \right )^{3} a^{3} c d -24 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} d^{2}-12 \tan \left (f x +e \right )^{3} a^{3} d^{2}-6 i \tan \left (f x +e \right )^{2} a^{3} c^{2}-3 i a^{3} d^{2} \tan \left (f x +e \right )^{4}-96 i x \,a^{3} c d f +48 x \,a^{3} c^{2} f -48 x \,a^{3} d^{2} f -36 \tan \left (f x +e \right )^{2} a^{3} c d +48 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c d -36 \tan \left (f x +e \right ) a^{3} c^{2}+48 \tan \left (f x +e \right ) a^{3} d^{2}}{12 f}\) \(235\)
risch \(\frac {16 i a^{3} c d e}{f}-\frac {8 a^{3} c^{2} e}{f}+\frac {8 a^{3} d^{2} e}{f}-\frac {2 i a^{3} \left (12 c^{2} {\mathrm e}^{6 i \left (f x +e \right )}-36 d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-48 i c d \,{\mathrm e}^{6 i \left (f x +e \right )}+33 c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-69 d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-114 i c d \,{\mathrm e}^{4 i \left (f x +e \right )}+30 c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-54 d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-92 i c d \,{\mathrm e}^{2 i \left (f x +e \right )}+9 c^{2}-15 d^{2}-26 i c d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {8 a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c d}{f}-\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{f}+\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{2}}{f}\) \(272\)

Input:

int((a+I*a*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
 

Output:

1/f*a^3*(-1/4*I*d^2*tan(f*x+e)^4-2/3*I*c*d*tan(f*x+e)^3-1/2*I*c^2*tan(f*x+ 
e)^2+2*I*d^2*tan(f*x+e)^2-d^2*tan(f*x+e)^3+8*I*tan(f*x+e)*c*d-3*c*d*tan(f* 
x+e)^2-3*c^2*tan(f*x+e)+4*d^2*tan(f*x+e)+1/2*(-4*I*d^2+4*I*c^2+8*c*d)*ln(1 
+tan(f*x+e)^2)+(-8*I*c*d-4*d^2+4*c^2)*arctan(tan(f*x+e)))
 

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. 359 vs. \(2 (127) = 254\).

Time = 0.12 (sec) , antiderivative size = 359, normalized size of antiderivative = 2.35 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=-\frac {2 \, {\left (9 i \, a^{3} c^{2} + 26 \, a^{3} c d - 15 i \, a^{3} d^{2} + 12 \, {\left (i \, a^{3} c^{2} + 4 \, a^{3} c d - 3 i \, a^{3} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (11 i \, a^{3} c^{2} + 38 \, a^{3} c d - 23 i \, a^{3} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (15 i \, a^{3} c^{2} + 46 \, a^{3} c d - 27 i \, a^{3} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2} + {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \] Input:

integrate((a+I*a*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="fricas")
 

Output:

-2/3*(9*I*a^3*c^2 + 26*a^3*c*d - 15*I*a^3*d^2 + 12*(I*a^3*c^2 + 4*a^3*c*d 
- 3*I*a^3*d^2)*e^(6*I*f*x + 6*I*e) + 3*(11*I*a^3*c^2 + 38*a^3*c*d - 23*I*a 
^3*d^2)*e^(4*I*f*x + 4*I*e) + 2*(15*I*a^3*c^2 + 46*a^3*c*d - 27*I*a^3*d^2) 
*e^(2*I*f*x + 2*I*e) + 6*(I*a^3*c^2 + 2*a^3*c*d - I*a^3*d^2 + (I*a^3*c^2 + 
 2*a^3*c*d - I*a^3*d^2)*e^(8*I*f*x + 8*I*e) + 4*(I*a^3*c^2 + 2*a^3*c*d - I 
*a^3*d^2)*e^(6*I*f*x + 6*I*e) + 6*(I*a^3*c^2 + 2*a^3*c*d - I*a^3*d^2)*e^(4 
*I*f*x + 4*I*e) + 4*(I*a^3*c^2 + 2*a^3*c*d - I*a^3*d^2)*e^(2*I*f*x + 2*I*e 
))*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(8*I*f*x + 8*I*e) + 4*f*e^(6*I*f*x + 
 6*I*e) + 6*f*e^(4*I*f*x + 4*I*e) + 4*f*e^(2*I*f*x + 2*I*e) + f)
 

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 313 vs. \(2 (129) = 258\).

Time = 0.54 (sec) , antiderivative size = 313, normalized size of antiderivative = 2.05 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=- \frac {4 i a^{3} \left (c - i d\right )^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 18 i a^{3} c^{2} - 52 a^{3} c d + 30 i a^{3} d^{2} + \left (- 60 i a^{3} c^{2} e^{2 i e} - 184 a^{3} c d e^{2 i e} + 108 i a^{3} d^{2} e^{2 i e}\right ) e^{2 i f x} + \left (- 66 i a^{3} c^{2} e^{4 i e} - 228 a^{3} c d e^{4 i e} + 138 i a^{3} d^{2} e^{4 i e}\right ) e^{4 i f x} + \left (- 24 i a^{3} c^{2} e^{6 i e} - 96 a^{3} c d e^{6 i e} + 72 i a^{3} d^{2} e^{6 i e}\right ) e^{6 i f x}}{3 f e^{8 i e} e^{8 i f x} + 12 f e^{6 i e} e^{6 i f x} + 18 f e^{4 i e} e^{4 i f x} + 12 f e^{2 i e} e^{2 i f x} + 3 f} \] Input:

integrate((a+I*a*tan(f*x+e))**3*(c+d*tan(f*x+e))**2,x)
 

Output:

-4*I*a**3*(c - I*d)**2*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-18*I*a**3*c** 
2 - 52*a**3*c*d + 30*I*a**3*d**2 + (-60*I*a**3*c**2*exp(2*I*e) - 184*a**3* 
c*d*exp(2*I*e) + 108*I*a**3*d**2*exp(2*I*e))*exp(2*I*f*x) + (-66*I*a**3*c* 
*2*exp(4*I*e) - 228*a**3*c*d*exp(4*I*e) + 138*I*a**3*d**2*exp(4*I*e))*exp( 
4*I*f*x) + (-24*I*a**3*c**2*exp(6*I*e) - 96*a**3*c*d*exp(6*I*e) + 72*I*a** 
3*d**2*exp(6*I*e))*exp(6*I*f*x))/(3*f*exp(8*I*e)*exp(8*I*f*x) + 12*f*exp(6 
*I*e)*exp(6*I*f*x) + 18*f*exp(4*I*e)*exp(4*I*f*x) + 12*f*exp(2*I*e)*exp(2* 
I*f*x) + 3*f)
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 181, normalized size of antiderivative = 1.18 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=-\frac {3 i \, a^{3} d^{2} \tan \left (f x + e\right )^{4} + 4 \, {\left (2 i \, a^{3} c d + 3 \, a^{3} d^{2}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (i \, a^{3} c^{2} + 6 \, a^{3} c d - 4 i \, a^{3} d^{2}\right )} \tan \left (f x + e\right )^{2} - 48 \, {\left (a^{3} c^{2} - 2 i \, a^{3} c d - a^{3} d^{2}\right )} {\left (f x + e\right )} + 24 \, {\left (-i \, a^{3} c^{2} - 2 \, a^{3} c d + i \, a^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (3 \, a^{3} c^{2} - 8 i \, a^{3} c d - 4 \, a^{3} d^{2}\right )} \tan \left (f x + e\right )}{12 \, f} \] Input:

integrate((a+I*a*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="maxima")
 

Output:

-1/12*(3*I*a^3*d^2*tan(f*x + e)^4 + 4*(2*I*a^3*c*d + 3*a^3*d^2)*tan(f*x + 
e)^3 + 6*(I*a^3*c^2 + 6*a^3*c*d - 4*I*a^3*d^2)*tan(f*x + e)^2 - 48*(a^3*c^ 
2 - 2*I*a^3*c*d - a^3*d^2)*(f*x + e) + 24*(-I*a^3*c^2 - 2*a^3*c*d + I*a^3* 
d^2)*log(tan(f*x + e)^2 + 1) + 12*(3*a^3*c^2 - 8*I*a^3*c*d - 4*a^3*d^2)*ta 
n(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 0.57 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.35 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=-\frac {4 \, {\left (-i \, a^{3} c^{2} - 2 \, a^{3} c d + i \, a^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{f} - \frac {3 i \, a^{3} d^{2} f^{3} \tan \left (f x + e\right )^{4} + 8 i \, a^{3} c d f^{3} \tan \left (f x + e\right )^{3} + 12 \, a^{3} d^{2} f^{3} \tan \left (f x + e\right )^{3} + 6 i \, a^{3} c^{2} f^{3} \tan \left (f x + e\right )^{2} + 36 \, a^{3} c d f^{3} \tan \left (f x + e\right )^{2} - 24 i \, a^{3} d^{2} f^{3} \tan \left (f x + e\right )^{2} + 36 \, a^{3} c^{2} f^{3} \tan \left (f x + e\right ) - 96 i \, a^{3} c d f^{3} \tan \left (f x + e\right ) - 48 \, a^{3} d^{2} f^{3} \tan \left (f x + e\right )}{12 \, f^{4}} \] Input:

integrate((a+I*a*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="giac")
 

Output:

-4*(-I*a^3*c^2 - 2*a^3*c*d + I*a^3*d^2)*log(tan(f*x + e) + I)/f - 1/12*(3* 
I*a^3*d^2*f^3*tan(f*x + e)^4 + 8*I*a^3*c*d*f^3*tan(f*x + e)^3 + 12*a^3*d^2 
*f^3*tan(f*x + e)^3 + 6*I*a^3*c^2*f^3*tan(f*x + e)^2 + 36*a^3*c*d*f^3*tan( 
f*x + e)^2 - 24*I*a^3*d^2*f^3*tan(f*x + e)^2 + 36*a^3*c^2*f^3*tan(f*x + e) 
 - 96*I*a^3*c*d*f^3*tan(f*x + e) - 48*a^3*d^2*f^3*tan(f*x + e))/f^4
 

Mupad [B] (verification not implemented)

Time = 1.96 (sec) , antiderivative size = 217, normalized size of antiderivative = 1.42 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^3\,d^2\,1{}\mathrm {i}}{2}-\frac {a^3\,\left (c^2\,1{}\mathrm {i}+4\,c\,d-d^2\,1{}\mathrm {i}\right )}{2}+a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}-\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {a^3\,d^2}{3}+\frac {2\,a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )}{3}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^3\,c^2\,4{}\mathrm {i}+8\,a^3\,c\,d-a^3\,d^2\,4{}\mathrm {i}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^3\,d^2+a^3\,\left (c^2\,1{}\mathrm {i}+4\,c\,d-d^2\,1{}\mathrm {i}\right )\,1{}\mathrm {i}-2\,a^3\,c\,\left (c-d\,1{}\mathrm {i}\right )+2\,a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )\right )}{f}-\frac {a^3\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^4\,1{}\mathrm {i}}{4\,f} \] Input:

int((a + a*tan(e + f*x)*1i)^3*(c + d*tan(e + f*x))^2,x)
 

Output:

(tan(e + f*x)^2*((a^3*d^2*1i)/2 - (a^3*(4*c*d + c^2*1i - d^2*1i))/2 + a^3* 
d*(c*1i + d)*1i))/f - (tan(e + f*x)^3*((a^3*d^2)/3 + (2*a^3*d*(c*1i + d))/ 
3))/f + (log(tan(e + f*x) + 1i)*(a^3*c^2*4i - a^3*d^2*4i + 8*a^3*c*d))/f + 
 (tan(e + f*x)*(a^3*d^2 + a^3*(4*c*d + c^2*1i - d^2*1i)*1i - 2*a^3*c*(c - 
d*1i) + 2*a^3*d*(c*1i + d)))/f - (a^3*d^2*tan(e + f*x)^4*1i)/(4*f)
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 192, normalized size of antiderivative = 1.25 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {a^{3} \left (24 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c^{2} i +48 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c d -24 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) d^{2} i -3 \tan \left (f x +e \right )^{4} d^{2} i -8 \tan \left (f x +e \right )^{3} c d i -12 \tan \left (f x +e \right )^{3} d^{2}-6 \tan \left (f x +e \right )^{2} c^{2} i -36 \tan \left (f x +e \right )^{2} c d +24 \tan \left (f x +e \right )^{2} d^{2} i -36 \tan \left (f x +e \right ) c^{2}+96 \tan \left (f x +e \right ) c d i +48 \tan \left (f x +e \right ) d^{2}+48 c^{2} f x -96 c d f i x -48 d^{2} f x \right )}{12 f} \] Input:

int((a+I*a*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x)
 

Output:

(a**3*(24*log(tan(e + f*x)**2 + 1)*c**2*i + 48*log(tan(e + f*x)**2 + 1)*c* 
d - 24*log(tan(e + f*x)**2 + 1)*d**2*i - 3*tan(e + f*x)**4*d**2*i - 8*tan( 
e + f*x)**3*c*d*i - 12*tan(e + f*x)**3*d**2 - 6*tan(e + f*x)**2*c**2*i - 3 
6*tan(e + f*x)**2*c*d + 24*tan(e + f*x)**2*d**2*i - 36*tan(e + f*x)*c**2 + 
 96*tan(e + f*x)*c*d*i + 48*tan(e + f*x)*d**2 + 48*c**2*f*x - 96*c*d*f*i*x 
 - 48*d**2*f*x))/(12*f)