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

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

Optimal result

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.82 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.10, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.321, Rules used = {3042, 4041, 27, 3042, 4072, 3042, 3956, 4009, 24}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4041

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4072

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4009

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

\(\Big \downarrow \) 24

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

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

rule 4041
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-(b*c - a*d))*(a + b*Tan[e + f*x])^m* 
((c + d*Tan[e + f*x])^(n - 1)/(2*a*f*m)), x] + Simp[1/(2*a^2*m)   Int[(a + 
b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 2)*Simp[c*(a*c*m + b*d*(n 
 - 1)) - d*(b*c*m + a*d*(n - 1)) - d*(b*d*(m - n + 1) - a*c*(m + n - 1))*Ta 
n[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] 
 && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && LtQ[m, 0] && GtQ[n, 1] && (In 
tegerQ[m] || IntegersQ[2*m, 2*n])
 

rule 4072
Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_ 
.)*(x_)]))/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B*(d/ 
b)   Int[Tan[e + f*x], x], x] + Simp[1/b   Int[Simp[A*b*c + (A*b*d + B*(b*c 
 - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d 
, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 
Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 224, normalized size of antiderivative = 1.65

method result size
risch \(-\frac {3 i x \,c^{2} d}{4 a^{2}}-\frac {7 i x \,d^{3}}{4 a^{2}}+\frac {c^{3} x}{4 a^{2}}-\frac {3 x c \,d^{2}}{4 a^{2}}-\frac {{\mathrm e}^{-2 i \left (f x +e \right )} d^{3}}{2 a^{2} f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{3}}{4 a^{2} f}+\frac {3 i {\mathrm e}^{-2 i \left (f x +e \right )} c \,d^{2}}{4 a^{2} f}-\frac {3 \,{\mathrm e}^{-4 i \left (f x +e \right )} c^{2} d}{16 a^{2} f}+\frac {{\mathrm e}^{-4 i \left (f x +e \right )} d^{3}}{16 a^{2} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} c^{3}}{16 a^{2} f}-\frac {3 i {\mathrm e}^{-4 i \left (f x +e \right )} c \,d^{2}}{16 a^{2} f}-\frac {2 i d^{3} e}{a^{2} f}+\frac {d^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a^{2} f}\) \(224\)
derivativedivides \(-\frac {d^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \,a^{2}}-\frac {i c^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {3 i c^{2} d}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 i c^{2} d \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}-\frac {3 i d^{3} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) c^{3}}{4 f \,a^{2}}-\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) c \,d^{2}}{4 f \,a^{2}}+\frac {5 i d^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 i c \,d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {9 c \,d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 c^{2} d}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {d^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}\) \(284\)
default \(-\frac {d^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \,a^{2}}-\frac {i c^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {3 i c^{2} d}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 i c^{2} d \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}-\frac {3 i d^{3} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) c^{3}}{4 f \,a^{2}}-\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) c \,d^{2}}{4 f \,a^{2}}+\frac {5 i d^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 i c \,d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {9 c \,d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 c^{2} d}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {d^{3}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}\) \(284\)

Input:

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

Output:

-3/4*I*x/a^2*c^2*d-7/4*I*x/a^2*d^3+1/4*c^3*x/a^2-3/4*x/a^2*c*d^2-1/2/a^2/f 
*exp(-2*I*(f*x+e))*d^3+1/4*I/a^2/f*exp(-2*I*(f*x+e))*c^3+3/4*I/a^2/f*exp(- 
2*I*(f*x+e))*c*d^2-3/16/a^2/f*exp(-4*I*(f*x+e))*c^2*d+1/16/a^2/f*exp(-4*I* 
(f*x+e))*d^3+1/16*I/a^2/f*exp(-4*I*(f*x+e))*c^3-3/16*I/a^2/f*exp(-4*I*(f*x 
+e))*c*d^2-2*I*d^3/a^2/f*e+d^3/a^2/f*ln(exp(2*I*(f*x+e))+1)
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 126, normalized size of antiderivative = 0.93 \[ \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx=\frac {{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 4 \, {\left (c^{3} - 3 i \, c^{2} d - 3 \, c d^{2} - 7 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} - 4 \, {\left (-i \, c^{3} - 3 i \, c d^{2} + 2 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \] Input:

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

Output:

1/16*(16*d^3*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 4*(c^3 - 3 
*I*c^2*d - 3*c*d^2 - 7*I*d^3)*f*x*e^(4*I*f*x + 4*I*e) + I*c^3 - 3*c^2*d - 
3*I*c*d^2 + d^3 - 4*(-I*c^3 - 3*I*c*d^2 + 2*d^3)*e^(2*I*f*x + 2*I*e))*e^(- 
4*I*f*x - 4*I*e)/(a^2*f)
 

Sympy [A] (verification not implemented)

Time = 0.42 (sec) , antiderivative size = 393, normalized size of antiderivative = 2.89 \[ \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx=\begin {cases} \frac {\left (\left (16 i a^{2} c^{3} f e^{4 i e} + 48 i a^{2} c d^{2} f e^{4 i e} - 32 a^{2} d^{3} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{3} f e^{2 i e} - 12 a^{2} c^{2} d f e^{2 i e} - 12 i a^{2} c d^{2} f e^{2 i e} + 4 a^{2} d^{3} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}}{4 a^{2}} + \frac {\left (c^{3} e^{4 i e} + 2 c^{3} e^{2 i e} + c^{3} - 3 i c^{2} d e^{4 i e} + 3 i c^{2} d - 3 c d^{2} e^{4 i e} + 6 c d^{2} e^{2 i e} - 3 c d^{2} - 7 i d^{3} e^{4 i e} + 4 i d^{3} e^{2 i e} - i d^{3}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {d^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} + \frac {x \left (c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}\right )}{4 a^{2}} \] Input:

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

Output:

Piecewise((((16*I*a**2*c**3*f*exp(4*I*e) + 48*I*a**2*c*d**2*f*exp(4*I*e) - 
 32*a**2*d**3*f*exp(4*I*e))*exp(-2*I*f*x) + (4*I*a**2*c**3*f*exp(2*I*e) - 
12*a**2*c**2*d*f*exp(2*I*e) - 12*I*a**2*c*d**2*f*exp(2*I*e) + 4*a**2*d**3* 
f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)/(64*a**4*f**2), Ne(a**4*f**2*exp( 
6*I*e), 0)), (x*(-(c**3 - 3*I*c**2*d - 3*c*d**2 - 7*I*d**3)/(4*a**2) + (c* 
*3*exp(4*I*e) + 2*c**3*exp(2*I*e) + c**3 - 3*I*c**2*d*exp(4*I*e) + 3*I*c** 
2*d - 3*c*d**2*exp(4*I*e) + 6*c*d**2*exp(2*I*e) - 3*c*d**2 - 7*I*d**3*exp( 
4*I*e) + 4*I*d**3*exp(2*I*e) - I*d**3)*exp(-4*I*e)/(4*a**2)), True)) + d** 
3*log(exp(2*I*f*x) + exp(-2*I*e))/(a**2*f) + x*(c**3 - 3*I*c**2*d - 3*c*d* 
*2 - 7*I*d**3)/(4*a**2)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \] Input:

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

Output:

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negati 
ve exponent.
 

Giac [A] (verification not implemented)

Time = 0.60 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.05 \[ \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx=-\frac {{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{8 \, a^{2} f} - \frac {{\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} + 7 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{8 \, a^{2} f} - \frac {2 i \, c^{3} + 6 i \, c d^{2} - 4 \, d^{3} - {\left (c^{3} - 3 i \, c^{2} d + 9 \, c d^{2} + 5 i \, d^{3}\right )} \tan \left (f x + e\right )}{4 \, a^{2} f {\left (\tan \left (f x + e\right ) - i\right )}^{2}} \] Input:

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

Output:

-1/8*(-I*c^3 - 3*c^2*d + 3*I*c*d^2 + d^3)*log(tan(f*x + e) + I)/(a^2*f) - 
1/8*(I*c^3 + 3*c^2*d - 3*I*c*d^2 + 7*d^3)*log(tan(f*x + e) - I)/(a^2*f) - 
1/4*(2*I*c^3 + 6*I*c*d^2 - 4*d^3 - (c^3 - 3*I*c^2*d + 9*c*d^2 + 5*I*d^3)*t 
an(f*x + e))/(a^2*f*(tan(f*x + e) - I)^2)
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [F]

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

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

Output:

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