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

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
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 = 115 \[ \int \frac {(a+i a \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {4 a^3 x}{c-i d}-\frac {a^3 (i c-3 d) \log (\cos (e+f x))}{d^2 f}-\frac {a^3 (c+i d)^2 \log (c \cos (e+f x)+d \sin (e+f x))}{d^2 (i c+d) f}-\frac {a^3+i a^3 \tan (e+f x)}{d f} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.89 (sec) , antiderivative size = 126, 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, 4039, 3042, 4072, 3042, 3956, 4014, 3042, 4013}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4039

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4072

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4014

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4013

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

Input:

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

Output:

(a*(-((a^2*(I*c - 3*d)*Log[Cos[e + f*x]])/(d*f)) + ((4*a^2*d^2*x)/(c - I*d 
) - (a^2*(c + I*d)^2*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((I*c + d)*f))/ 
d))/d - (a^3 + I*a^3*Tan[e + f*x])/(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 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[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] && EqQ[a*c + b*d, 0]
 

rule 4014
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a 
*d)/(a^2 + b^2)   Int[(b - a*Tan[e + f*x])/(a + b*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] && N 
eQ[a*c + b*d, 0]
 

rule 4039
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c + 
 d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Simp[a/(d*(m + n - 1)) 
Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^n*Simp[b*c*(m - 2) + 
a*d*(m + 2*n) + (a*c*(m - 2) + b*d*(3*m + 2*n - 4))*Tan[e + f*x], x], x], x 
] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 
 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && GtQ[m, 1] && NeQ[m + n - 1, 0] 
 && (IntegerQ[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.25 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.93

method result size
norman \(\frac {4 a^{3} x}{-i d +c}-\frac {i a^{3} \tan \left (f x +e \right )}{d f}+\frac {i a^{3} \left (2 i c d +c^{2}-d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} f \left (-i d +c \right )}+\frac {2 i a^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f \left (-i d +c \right )}\) \(107\)
derivativedivides \(\frac {a^{3} \left (-\frac {i \tan \left (f x +e \right )}{d}+\frac {\frac {\left (4 i c -4 d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (4 i d +4 c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}\right )}{f}\) \(116\)
default \(\frac {a^{3} \left (-\frac {i \tan \left (f x +e \right )}{d}+\frac {\frac {\left (4 i c -4 d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (4 i d +4 c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}\right )}{f}\) \(116\)
parallelrisch \(\frac {4 i x \,a^{3} d^{3} f +2 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c \,d^{2}+i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c^{3}-3 i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c \,d^{2}-i \tan \left (f x +e \right ) a^{3} c^{2} d -i \tan \left (f x +e \right ) a^{3} d^{3}+4 x \,a^{3} c \,d^{2} f -2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} d^{3}-3 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c^{2} d +\ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} d^{3}}{d^{2} f \left (c^{2}+d^{2}\right )}\) \(190\)
risch \(-\frac {8 a^{3} x}{i d -c}+\frac {2 i a^{3} c^{2} x}{d^{2} \left (i c +d \right )}-\frac {6 i a^{3} e}{d f}-\frac {2 a^{3} c x}{d^{2}}-\frac {2 a^{3} c e}{d^{2} f}-\frac {4 a^{3} c x}{d \left (i c +d \right )}-\frac {4 a^{3} c e}{d f \left (i c +d \right )}-\frac {2 i a^{3} x}{i c +d}-\frac {2 i a^{3} e}{f \left (i c +d \right )}-\frac {2 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) c}{d f \left (i c +d \right )}-\frac {6 i a^{3} x}{d}+\frac {2 a^{3}}{f d \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {3 a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{d f}+\frac {2 i a^{3} c^{2} e}{d^{2} f \left (i c +d \right )}-\frac {i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{d^{2} f}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) c^{2}}{d^{2} f \left (i c +d \right )}+\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (i c +d \right )}\) \(398\)

Input:

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

Output:

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

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. 211 vs. \(2 (105) = 210\).

Time = 0.12 (sec) , antiderivative size = 211, normalized size of antiderivative = 1.83 \[ \int \frac {(a+i a \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {2 i \, a^{3} c d + 2 \, a^{3} d^{2} - {\left (a^{3} c^{2} + 2 i \, a^{3} c d - a^{3} d^{2} + {\left (a^{3} c^{2} + 2 i \, a^{3} c d - a^{3} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) + {\left (a^{3} c^{2} + 2 i \, a^{3} c d + 3 \, a^{3} d^{2} + {\left (a^{3} c^{2} + 2 i \, a^{3} c d + 3 \, 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 )}{{\left (i \, c d^{2} + d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, c d^{2} + d^{3}\right )} f} \] Input:

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

Output:

(2*I*a^3*c*d + 2*a^3*d^2 - (a^3*c^2 + 2*I*a^3*c*d - a^3*d^2 + (a^3*c^2 + 2 
*I*a^3*c*d - a^3*d^2)*e^(2*I*f*x + 2*I*e))*log(((I*c + d)*e^(2*I*f*x + 2*I 
*e) + I*c - d)/(I*c + d)) + (a^3*c^2 + 2*I*a^3*c*d + 3*a^3*d^2 + (a^3*c^2 
+ 2*I*a^3*c*d + 3*a^3*d^2)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 
1))/((I*c*d^2 + d^3)*f*e^(2*I*f*x + 2*I*e) + (I*c*d^2 + d^3)*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. 257 vs. \(2 (92) = 184\).

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

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

Output:

2*a**3/(d*f*exp(2*I*e)*exp(2*I*f*x) + d*f) - I*a**3*(c + 3*I*d)*log(exp(2* 
I*f*x) + (a**3*c**2 + 3*I*a**3*c*d - 2*a**3*d**2 - I*a**3*d*(c + 3*I*d))/( 
a**3*c**2*exp(2*I*e) + 2*I*a**3*c*d*exp(2*I*e) + a**3*d**2*exp(2*I*e)))/(d 
**2*f) + I*a**3*(c + I*d)**2*log(exp(2*I*f*x) + (a**3*c**2 + 3*I*a**3*c*d 
- 2*a**3*d**2 + I*a**3*d*(c + I*d)**2/(c - I*d))/(a**3*c**2*exp(2*I*e) + 2 
*I*a**3*c*d*exp(2*I*e) + a**3*d**2*exp(2*I*e)))/(d**2*f*(c - I*d))
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

4*I*a^3*log(tan(f*x + e) + I)/(c*f - I*d*f) - I*a^3*tan(f*x + e)/(d*f) - ( 
-I*a^3*c^2 + 2*a^3*c*d + I*a^3*d^2)*log(abs(d*tan(f*x + e) + c))/(c*d^2*f 
- I*d^3*f)
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

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