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

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.98 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.15, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3042, 4036, 25, 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))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4036

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4072

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4014

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4013

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], 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 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 4036
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-a^2)*(b*c - a*d)*(a + b*Tan[e + f*x] 
)^(m - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(b*c + a*d)*(n + 1))), x] + Si 
mp[a/(d*(b*c + a*d)*(n + 1))   Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[ 
e + f*x])^(n + 1)*Simp[b*(b*c*(m - 2) - a*d*(m - 2*n - 4)) + (a*b*c*(m - 2) 
 + b^2*d*(n + 1) - a^2*d*(m + n - 1))*Tan[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] && GtQ[m, 1] && LtQ[n, -1] && (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.26 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.23

method result size
derivativedivides \(\frac {a^{3} \left (\frac {\left (-i c^{4}-6 i c^{2} d^{2}+3 i d^{4}+8 c \,d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2} d^{2}}-\frac {i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}}{d^{2} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\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 )}{\left (c^{2}+d^{2}\right )^{2}}\right )}{f}\) \(175\)
default \(\frac {a^{3} \left (\frac {\left (-i c^{4}-6 i c^{2} d^{2}+3 i d^{4}+8 c \,d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2} d^{2}}-\frac {i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}}{d^{2} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\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 )}{\left (c^{2}+d^{2}\right )^{2}}\right )}{f}\) \(175\)
norman \(\frac {\frac {i \left (2 i a^{3} c d +a^{3} c^{2}-a^{3} d^{2}\right ) \tan \left (f x +e \right )}{c f \left (-i d +c \right ) d}+\frac {4 a^{3} c x}{-2 i c d +c^{2}-d^{2}}-\frac {4 d \,a^{3} x \tan \left (f x +e \right )}{2 i c d -c^{2}+d^{2}}}{c +d \tan \left (f x +e \right )}+\frac {2 i a^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f \left (-2 i c d +c^{2}-d^{2}\right )}-\frac {i a^{3} \left (-2 i c d +c^{2}+3 d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} f \left (-2 i c d +c^{2}-d^{2}\right )}\) \(207\)
parallelrisch \(\frac {4 x \tan \left (f x +e \right ) a^{3} c^{2} d^{3} f -a^{3} d^{5}-4 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{3} c \,d^{4}+8 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{3} c \,d^{4}-4 x \tan \left (f x +e \right ) a^{3} d^{5} f +4 x \,a^{3} c^{3} d^{2} f -4 x \,a^{3} c \,d^{4} f -i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c^{5}+2 i a^{3} c^{3} d^{2}+3 i a^{3} c \,d^{4}+2 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{3} c^{2} d^{3}-i \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{3} c^{4} d -6 i \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{3} c^{2} d^{3}+8 i x \,a^{3} c^{2} d^{3} f -4 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c^{2} d^{3}+8 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c^{2} d^{3}-2 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{3} d^{5}+3 i \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{3} d^{5}+2 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c^{3} d^{2}-2 i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c \,d^{4}-6 i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c^{3} d^{2}+3 i \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} c \,d^{4}+8 i x \tan \left (f x +e \right ) a^{3} c \,d^{4} f -i a^{3} c^{5}+3 a^{3} c^{4} d +2 a^{3} c^{2} d^{3}}{f \left (c^{2}+d^{2}\right )^{2} d^{2} \left (c +d \tan \left (f x +e \right )\right )}\) \(521\)
risch \(-\frac {8 a^{3} x}{2 i c d -c^{2}+d^{2}}-\frac {4 a^{3} c x}{d \left (i c^{2}-i d^{2}+2 c d \right )}-\frac {4 a^{3} c e}{d f \left (i c^{2}-i d^{2}+2 c d \right )}-\frac {2 i a^{3} c^{2} x}{d^{2} \left (i c^{2}-i d^{2}+2 c d \right )}-\frac {6 i a^{3} e}{f \left (i c^{2}-i d^{2}+2 c d \right )}-\frac {2 i a^{3} c^{2} e}{d^{2} f \left (i c^{2}-i d^{2}+2 c d \right )}-\frac {4 i a^{3} c}{f \left (-i d +c \right )^{2} \left (-i d \,{\mathrm e}^{2 i \left (f x +e \right )}+{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}+\frac {2 a^{3} x}{d^{2}}+\frac {2 a^{3} e}{d^{2} f}+\frac {i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{d^{2} f}-\frac {2 a^{3} c^{2}}{f d \left (-i d +c \right )^{2} \left (-i d \,{\mathrm e}^{2 i \left (f x +e \right )}+{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}+\frac {2 a^{3} d}{f \left (-i d +c \right )^{2} \left (-i d \,{\mathrm e}^{2 i \left (f x +e \right )}+{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \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^{2}-i d^{2}+2 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 ) c^{2}}{d^{2} f \left (i c^{2}-i d^{2}+2 c d \right )}+\frac {3 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^{2}-i d^{2}+2 c d \right )}-\frac {6 i a^{3} x}{i c^{2}-i d^{2}+2 c d}\) \(583\)

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/(c^2+d^2)^2*(-I*c^4-6*I*c^2*d^2+3*I*d^4+8*c*d^3)/d^2*ln(c+d*tan 
(f*x+e))-(I*c^3-3*I*c*d^2-3*c^2*d+d^3)/d^2/(c^2+d^2)/(c+d*tan(f*x+e))+1/(c 
^2+d^2)^2*(1/2*(4*I*c^2-4*I*d^2-8*c*d)*ln(1+tan(f*x+e)^2)+(8*I*c*d+4*c^2-4 
*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. 298 vs. \(2 (126) = 252\).

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

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

Output:

(2*I*a^3*c^2*d - 4*a^3*c*d^2 - 2*I*a^3*d^3 - (a^3*c^3 - I*a^3*c^2*d + 5*a^ 
3*c*d^2 + 3*I*a^3*d^3 + (a^3*c^3 - 3*I*a^3*c^2*d + a^3*c*d^2 - 3*I*a^3*d^3 
)*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^3 - I*a^3*c^2*d + a^3*c*d^2 - I*a^3*d^3 + (a^3*c^3 - 3*I*a^ 
3*c^2*d - 3*a^3*c*d^2 + I*a^3*d^3)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2 
*I*e) + 1))/((-I*c^3*d^2 - 3*c^2*d^3 + 3*I*c*d^4 + d^5)*f*e^(2*I*f*x + 2*I 
*e) + (-I*c^3*d^2 - c^2*d^3 - I*c*d^4 - d^5)*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. 374 vs. \(2 (116) = 232\).

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

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

Output:

-I*a**3*(c - 3*I*d)*(c + I*d)*log(exp(2*I*f*x) + (a**3*c**2 + I*a**3*c*d*( 
c - 3*I*d)*(c + I*d)/(c - I*d)**2 - I*a**3*c*d + a**3*d**2*(c - 3*I*d)*(c 
+ I*d)/(c - I*d)**2 + 2*a**3*d**2)/(a**3*c**2*exp(2*I*e) - 2*I*a**3*c*d*ex 
p(2*I*e) + a**3*d**2*exp(2*I*e)))/(d**2*f*(c - I*d)**2) + I*a**3*log((a**3 
*c**2 - 2*I*a**3*c*d + a**3*d**2)/(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)) + exp(2*I*f*x))/(d**2*f) + (-2*a**3*c**2 - 
 4*I*a**3*c*d + 2*a**3*d**2)/(c**3*d*f - I*c**2*d**2*f + c*d**3*f - I*d**4 
*f + (c**3*d*f*exp(2*I*e) - 3*I*c**2*d**2*f*exp(2*I*e) - 3*c*d**3*f*exp(2* 
I*e) + I*d**4*f*exp(2*I*e))*exp(2*I*f*x))
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

(a**3*(2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*c**3*d**3*i - 4*log(tan(e + 
 f*x)**2 + 1)*tan(e + f*x)*c**2*d**4 - 2*log(tan(e + f*x)**2 + 1)*tan(e + 
f*x)*c*d**5*i + 2*log(tan(e + f*x)**2 + 1)*c**4*d**2*i - 4*log(tan(e + f*x 
)**2 + 1)*c**3*d**3 - 2*log(tan(e + f*x)**2 + 1)*c**2*d**4*i - log(tan(e + 
 f*x)*d + c)*tan(e + f*x)*c**5*d*i - 6*log(tan(e + f*x)*d + c)*tan(e + f*x 
)*c**3*d**3*i + 8*log(tan(e + f*x)*d + c)*tan(e + f*x)*c**2*d**4 + 3*log(t 
an(e + f*x)*d + c)*tan(e + f*x)*c*d**5*i - log(tan(e + f*x)*d + c)*c**6*i 
- 6*log(tan(e + f*x)*d + c)*c**4*d**2*i + 8*log(tan(e + f*x)*d + c)*c**3*d 
**3 + 3*log(tan(e + f*x)*d + c)*c**2*d**4*i + tan(e + f*x)*c**5*d*i - 3*ta 
n(e + f*x)*c**4*d**2 + 4*tan(e + f*x)*c**3*d**3*f*x - 2*tan(e + f*x)*c**3* 
d**3*i + 8*tan(e + f*x)*c**2*d**4*f*i*x - 2*tan(e + f*x)*c**2*d**4 - 4*tan 
(e + f*x)*c*d**5*f*x - 3*tan(e + f*x)*c*d**5*i + tan(e + f*x)*d**6 + 4*c** 
4*d**2*f*x + 8*c**3*d**3*f*i*x - 4*c**2*d**4*f*x))/(c*d**2*f*(tan(e + f*x) 
*c**4*d + 2*tan(e + f*x)*c**2*d**3 + tan(e + f*x)*d**5 + c**5 + 2*c**3*d** 
2 + c*d**4))