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

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 = 141 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=2 a^2 (c-i d)^3 x+\frac {2 a^2 (i c+d)^3 \log (\cos (e+f x))}{f}+\frac {2 i a^2 (c-i d)^2 d \tan (e+f x)}{f}+\frac {a^2 (i c+d) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.74 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.00, 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, 4011, 3042, 4011, 3042, 4008, 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))^2 (c+d \tan (e+f x))^3 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4026

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

Input:

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

Output:

2*a^2*(c - I*d)^3*x + (2*a^2*(I*c + d)^3*Log[Cos[e + f*x]])/f + ((2*I)*a^2 
*(c - I*d)^2*d*Tan[e + f*x])/f + (a^2*(I*c + d)*(c + d*Tan[e + f*x])^2)/f 
+ (((2*I)/3)*a^2*(c + d*Tan[e + f*x])^3)/f - (a^2*(c + d*Tan[e + f*x])^4)/ 
(4*d*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 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
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] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[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.24 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.49

method result size
derivativedivides \(\frac {a^{2} \left (\frac {2 i d^{3} \tan \left (f x +e \right )^{3}}{3}-\frac {d^{3} \tan \left (f x +e \right )^{4}}{4}+3 i c \,d^{2} \tan \left (f x +e \right )^{2}-c \,d^{2} \tan \left (f x +e \right )^{3}+6 i \tan \left (f x +e \right ) c^{2} d -2 i \tan \left (f x +e \right ) d^{3}-\frac {3 c^{2} d \tan \left (f x +e \right )^{2}}{2}+d^{3} \tan \left (f x +e \right )^{2}-c^{3} \tan \left (f x +e \right )+6 c \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{3}-6 i c \,d^{2}+6 c^{2} d -2 d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-6 i c^{2} d +2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(210\)
default \(\frac {a^{2} \left (\frac {2 i d^{3} \tan \left (f x +e \right )^{3}}{3}-\frac {d^{3} \tan \left (f x +e \right )^{4}}{4}+3 i c \,d^{2} \tan \left (f x +e \right )^{2}-c \,d^{2} \tan \left (f x +e \right )^{3}+6 i \tan \left (f x +e \right ) c^{2} d -2 i \tan \left (f x +e \right ) d^{3}-\frac {3 c^{2} d \tan \left (f x +e \right )^{2}}{2}+d^{3} \tan \left (f x +e \right )^{2}-c^{3} \tan \left (f x +e \right )+6 c \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{3}-6 i c \,d^{2}+6 c^{2} d -2 d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-6 i c^{2} d +2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(210\)
norman \(\left (-6 i a^{2} c^{2} d +2 i a^{2} d^{3}+2 a^{2} c^{3}-6 a^{2} c \,d^{2}\right ) x -\frac {\left (-2 i a^{2} d^{3}+3 a^{2} c \,d^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (6 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +2 a^{2} d^{3}\right ) \tan \left (f x +e \right )^{2}}{2 f}-\frac {\left (-6 i a^{2} c^{2} d +2 i a^{2} d^{3}+a^{2} c^{3}-6 a^{2} c \,d^{2}\right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} d^{3} \tan \left (f x +e \right )^{4}}{4 f}-\frac {\left (-i a^{2} c^{3}+3 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +a^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f}\) \(232\)
parts \(a^{2} c^{3} x +\frac {\left (2 i a^{2} c^{3}+3 a^{2} c^{2} d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (2 i a^{2} d^{3}-3 a^{2} c \,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 (6 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +a^{2} d^{3}\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^{2} c^{2} d -a^{2} c^{3}+3 a^{2} c \,d^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {a^{2} d^{3} \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}\) \(242\)
parallelrisch \(\frac {-36 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} c \,d^{2}-3 \tan \left (f x +e \right )^{4} a^{2} d^{3}+8 i \tan \left (f x +e \right )^{3} a^{2} d^{3}+72 i \tan \left (f x +e \right ) a^{2} c^{2} d +24 i x \,a^{2} d^{3} f -12 \tan \left (f x +e \right )^{3} a^{2} c \,d^{2}+36 i \tan \left (f x +e \right )^{2} a^{2} c \,d^{2}+12 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} c^{3}-24 i \tan \left (f x +e \right ) a^{2} d^{3}-72 i x \,a^{2} c^{2} d f +24 x \,a^{2} c^{3} f -72 x \,a^{2} c \,d^{2} f -18 \tan \left (f x +e \right )^{2} a^{2} c^{2} d +12 \tan \left (f x +e \right )^{2} a^{2} d^{3}+36 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} c^{2} d -12 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} d^{3}-12 \tan \left (f x +e \right ) a^{2} c^{3}+72 \tan \left (f x +e \right ) a^{2} c \,d^{2}}{12 f}\) \(292\)
risch \(\frac {6 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c \,d^{2}}{f}+\frac {12 i a^{2} c^{2} d e}{f}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{3}}{f}-\frac {4 i a^{2} d^{3} e}{f}-\frac {4 a^{2} c^{3} e}{f}+\frac {12 a^{2} c \,d^{2} e}{f}+\frac {2 a^{2} \left (-9 i c^{3} {\mathrm e}^{2 i \left (f x +e \right )}+45 i c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-27 c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}+21 d^{3} {\mathrm e}^{6 i \left (f x +e \right )}-3 i c^{3} {\mathrm e}^{6 i \left (f x +e \right )}-9 i c^{3} {\mathrm e}^{4 i \left (f x +e \right )}-72 c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}+36 d^{3} {\mathrm e}^{4 i \left (f x +e \right )}+75 i c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+99 i c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-63 c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+29 d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+21 i c \,d^{2}-3 i c^{3}-18 c^{2} d +8 d^{3}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {6 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2} d}{f}+\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{3}}{f}\) \(376\)

Input:

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

Output:

1/f*a^2*(2/3*I*d^3*tan(f*x+e)^3-1/4*d^3*tan(f*x+e)^4+3*I*c*d^2*tan(f*x+e)^ 
2-c*d^2*tan(f*x+e)^3+6*I*tan(f*x+e)*c^2*d-2*I*tan(f*x+e)*d^3-3/2*c^2*d*tan 
(f*x+e)^2+d^3*tan(f*x+e)^2-c^3*tan(f*x+e)+6*c*d^2*tan(f*x+e)+1/2*(-2*d^3+6 
*c^2*d-6*I*c*d^2+2*I*c^3)*ln(1+tan(f*x+e)^2)+(2*I*d^3-6*I*c^2*d+2*c^3-6*c* 
d^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. 457 vs. \(2 (125) = 250\).

Time = 0.09 (sec) , antiderivative size = 457, normalized size of antiderivative = 3.24 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {2 \, {\left (3 i \, a^{2} c^{3} + 18 \, a^{2} c^{2} d - 21 i \, a^{2} c d^{2} - 8 \, a^{2} d^{3} + 3 \, {\left (i \, a^{2} c^{3} + 9 \, a^{2} c^{2} d - 15 i \, a^{2} c d^{2} - 7 \, a^{2} d^{3}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 9 \, {\left (i \, a^{2} c^{3} + 8 \, a^{2} c^{2} d - 11 i \, a^{2} c d^{2} - 4 \, a^{2} d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (9 i \, a^{2} c^{3} + 63 \, a^{2} c^{2} d - 75 i \, a^{2} c d^{2} - 29 \, a^{2} d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 3 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3} + {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\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))^2*(c+d*tan(f*x+e))^3,x, algorithm="fricas")
 

Output:

-2/3*(3*I*a^2*c^3 + 18*a^2*c^2*d - 21*I*a^2*c*d^2 - 8*a^2*d^3 + 3*(I*a^2*c 
^3 + 9*a^2*c^2*d - 15*I*a^2*c*d^2 - 7*a^2*d^3)*e^(6*I*f*x + 6*I*e) + 9*(I* 
a^2*c^3 + 8*a^2*c^2*d - 11*I*a^2*c*d^2 - 4*a^2*d^3)*e^(4*I*f*x + 4*I*e) + 
(9*I*a^2*c^3 + 63*a^2*c^2*d - 75*I*a^2*c*d^2 - 29*a^2*d^3)*e^(2*I*f*x + 2* 
I*e) + 3*(I*a^2*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3 + (I*a^2*c^3 + 
 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(8*I*f*x + 8*I*e) + 4*(I*a^2*c^3 
 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(6*I*f*x + 6*I*e) + 6*(I*a^2*c 
^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(4*I*f*x + 4*I*e) + 4*(I*a^2 
*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*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. 381 vs. \(2 (122) = 244\).

Time = 0.63 (sec) , antiderivative size = 381, normalized size of antiderivative = 2.70 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=- \frac {2 i a^{2} \left (c - i d\right )^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 6 i a^{2} c^{3} - 36 a^{2} c^{2} d + 42 i a^{2} c d^{2} + 16 a^{2} d^{3} + \left (- 18 i a^{2} c^{3} e^{2 i e} - 126 a^{2} c^{2} d e^{2 i e} + 150 i a^{2} c d^{2} e^{2 i e} + 58 a^{2} d^{3} e^{2 i e}\right ) e^{2 i f x} + \left (- 18 i a^{2} c^{3} e^{4 i e} - 144 a^{2} c^{2} d e^{4 i e} + 198 i a^{2} c d^{2} e^{4 i e} + 72 a^{2} d^{3} e^{4 i e}\right ) e^{4 i f x} + \left (- 6 i a^{2} c^{3} e^{6 i e} - 54 a^{2} c^{2} d e^{6 i e} + 90 i a^{2} c d^{2} e^{6 i e} + 42 a^{2} d^{3} 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))**2*(c+d*tan(f*x+e))**3,x)
 

Output:

-2*I*a**2*(c - I*d)**3*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-6*I*a**2*c**3 
 - 36*a**2*c**2*d + 42*I*a**2*c*d**2 + 16*a**2*d**3 + (-18*I*a**2*c**3*exp 
(2*I*e) - 126*a**2*c**2*d*exp(2*I*e) + 150*I*a**2*c*d**2*exp(2*I*e) + 58*a 
**2*d**3*exp(2*I*e))*exp(2*I*f*x) + (-18*I*a**2*c**3*exp(4*I*e) - 144*a**2 
*c**2*d*exp(4*I*e) + 198*I*a**2*c*d**2*exp(4*I*e) + 72*a**2*d**3*exp(4*I*e 
))*exp(4*I*f*x) + (-6*I*a**2*c**3*exp(6*I*e) - 54*a**2*c**2*d*exp(6*I*e) + 
 90*I*a**2*c*d**2*exp(6*I*e) + 42*a**2*d**3*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 = 218, normalized size of antiderivative = 1.55 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {3 \, a^{2} d^{3} \tan \left (f x + e\right )^{4} + 4 \, {\left (3 \, a^{2} c d^{2} - 2 i \, a^{2} d^{3}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (3 \, a^{2} c^{2} d - 6 i \, a^{2} c d^{2} - 2 \, a^{2} d^{3}\right )} \tan \left (f x + e\right )^{2} - 24 \, {\left (a^{2} c^{3} - 3 i \, a^{2} c^{2} d - 3 \, a^{2} c d^{2} + i \, a^{2} d^{3}\right )} {\left (f x + e\right )} - 12 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (a^{2} c^{3} - 6 i \, a^{2} c^{2} d - 6 \, a^{2} c d^{2} + 2 i \, a^{2} d^{3}\right )} \tan \left (f x + e\right )}{12 \, f} \] Input:

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.60 (sec) , antiderivative size = 242, normalized size of antiderivative = 1.72 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {2 \, {\left (-i \, a^{2} c^{3} - 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} + a^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{f} - \frac {3 \, a^{2} d^{3} f^{3} \tan \left (f x + e\right )^{4} + 12 \, a^{2} c d^{2} f^{3} \tan \left (f x + e\right )^{3} - 8 i \, a^{2} d^{3} f^{3} \tan \left (f x + e\right )^{3} + 18 \, a^{2} c^{2} d f^{3} \tan \left (f x + e\right )^{2} - 36 i \, a^{2} c d^{2} f^{3} \tan \left (f x + e\right )^{2} - 12 \, a^{2} d^{3} f^{3} \tan \left (f x + e\right )^{2} + 12 \, a^{2} c^{3} f^{3} \tan \left (f x + e\right ) - 72 i \, a^{2} c^{2} d f^{3} \tan \left (f x + e\right ) - 72 \, a^{2} c d^{2} f^{3} \tan \left (f x + e\right ) + 24 i \, a^{2} d^{3} f^{3} \tan \left (f x + e\right )}{12 \, f^{4}} \] Input:

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

Output:

-2*(-I*a^2*c^3 - 3*a^2*c^2*d + 3*I*a^2*c*d^2 + a^2*d^3)*log(tan(f*x + e) + 
 I)/f - 1/12*(3*a^2*d^3*f^3*tan(f*x + e)^4 + 12*a^2*c*d^2*f^3*tan(f*x + e) 
^3 - 8*I*a^2*d^3*f^3*tan(f*x + e)^3 + 18*a^2*c^2*d*f^3*tan(f*x + e)^2 - 36 
*I*a^2*c*d^2*f^3*tan(f*x + e)^2 - 12*a^2*d^3*f^3*tan(f*x + e)^2 + 12*a^2*c 
^3*f^3*tan(f*x + e) - 72*I*a^2*c^2*d*f^3*tan(f*x + e) - 72*a^2*c*d^2*f^3*t 
an(f*x + e) + 24*I*a^2*d^3*f^3*tan(f*x + e))/f^4
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.70 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {a^{2} \left (12 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c^{3} i +36 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c^{2} d -36 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c \,d^{2} i -12 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) d^{3}-3 \tan \left (f x +e \right )^{4} d^{3}-12 \tan \left (f x +e \right )^{3} c \,d^{2}+8 \tan \left (f x +e \right )^{3} d^{3} i -18 \tan \left (f x +e \right )^{2} c^{2} d +36 \tan \left (f x +e \right )^{2} c \,d^{2} i +12 \tan \left (f x +e \right )^{2} d^{3}-12 \tan \left (f x +e \right ) c^{3}+72 \tan \left (f x +e \right ) c^{2} d i +72 \tan \left (f x +e \right ) c \,d^{2}-24 \tan \left (f x +e \right ) d^{3} i +24 c^{3} f x -72 c^{2} d f i x -72 c \,d^{2} f x +24 d^{3} f i x \right )}{12 f} \] Input:

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

Output:

(a**2*(12*log(tan(e + f*x)**2 + 1)*c**3*i + 36*log(tan(e + f*x)**2 + 1)*c* 
*2*d - 36*log(tan(e + f*x)**2 + 1)*c*d**2*i - 12*log(tan(e + f*x)**2 + 1)* 
d**3 - 3*tan(e + f*x)**4*d**3 - 12*tan(e + f*x)**3*c*d**2 + 8*tan(e + f*x) 
**3*d**3*i - 18*tan(e + f*x)**2*c**2*d + 36*tan(e + f*x)**2*c*d**2*i + 12* 
tan(e + f*x)**2*d**3 - 12*tan(e + f*x)*c**3 + 72*tan(e + f*x)*c**2*d*i + 7 
2*tan(e + f*x)*c*d**2 - 24*tan(e + f*x)*d**3*i + 24*c**3*f*x - 72*c**2*d*f 
*i*x - 72*c*d**2*f*x + 24*d**3*f*i*x))/(12*f)