\(\int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx\) [687]

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

Optimal result

Integrand size = 41, antiderivative size = 95 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=\frac {2 a^2 (A-i B)}{5 c^5 f (i+\tan (e+f x))^5}+\frac {a^2 (i A+3 B)}{4 c^5 f (i+\tan (e+f x))^4}+\frac {i a^2 B}{3 c^5 f (i+\tan (e+f x))^3} \] Output:

2/5*a^2*(A-I*B)/c^5/f/(I+tan(f*x+e))^5+1/4*a^2*(I*A+3*B)/c^5/f/(I+tan(f*x+ 
e))^4+1/3*I*a^2*B/c^5/f/(I+tan(f*x+e))^3
 

Mathematica [A] (verified)

Time = 5.25 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.65 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=\frac {a^2 \left (9 A+i B+5 (3 i A+B) \tan (e+f x)+20 i B \tan ^2(e+f x)\right )}{60 c^5 f (i+\tan (e+f x))^5} \] Input:

Integrate[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + 
 f*x])^5,x]
 

Output:

(a^2*(9*A + I*B + 5*((3*I)*A + B)*Tan[e + f*x] + (20*I)*B*Tan[e + f*x]^2)) 
/(60*c^5*f*(I + Tan[e + f*x])^5)
 

Rubi [A] (verified)

Time = 0.54 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.82, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.122, Rules used = {3042, 4071, 27, 86, 2009}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5}dx\)

\(\Big \downarrow \) 4071

\(\displaystyle \frac {a c \int \frac {a (i \tan (e+f x)+1) (A+B \tan (e+f x))}{c^6 (1-i \tan (e+f x))^6}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {a^2 \int \frac {(i \tan (e+f x)+1) (A+B \tan (e+f x))}{(1-i \tan (e+f x))^6}d\tan (e+f x)}{c^5 f}\)

\(\Big \downarrow \) 86

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^2 \left (\frac {2 (A-i B)}{5 (\tan (e+f x)+i)^5}+\frac {3 B+i A}{4 (\tan (e+f x)+i)^4}+\frac {i B}{3 (\tan (e+f x)+i)^3}\right )}{c^5 f}\)

Input:

Int[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]) 
^5,x]
 

Output:

(a^2*((2*(A - I*B))/(5*(I + Tan[e + f*x])^5) + (I*A + 3*B)/(4*(I + Tan[e + 
 f*x])^4) + ((I/3)*B)/(I + Tan[e + f*x])^3))/(c^5*f)
 

Defintions of rubi rules used

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 86
Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_ 
.), x_] :> Int[ExpandIntegrand[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; 
 FreeQ[{a, b, c, d, e, f, n}, x] && ((ILtQ[n, 0] && ILtQ[p, 0]) || EqQ[p, 1 
] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p 
+ 1, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 4071
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + 
 (f_.)*(x_)])*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Si 
mp[a*(c/f)   Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x], x 
, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c 
+ a*d, 0] && EqQ[a^2 + b^2, 0]
 
Maple [A] (verified)

Time = 0.48 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.73

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {-i A -3 B}{4 \left (i+\tan \left (f x +e \right )\right )^{4}}-\frac {2 i B -2 A}{5 \left (i+\tan \left (f x +e \right )\right )^{5}}+\frac {i B}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{5}}\) \(69\)
default \(\frac {a^{2} \left (-\frac {-i A -3 B}{4 \left (i+\tan \left (f x +e \right )\right )^{4}}-\frac {2 i B -2 A}{5 \left (i+\tan \left (f x +e \right )\right )^{5}}+\frac {i B}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{5}}\) \(69\)
risch \(-\frac {a^{2} {\mathrm e}^{10 i \left (f x +e \right )} B}{80 c^{5} f}-\frac {i a^{2} {\mathrm e}^{10 i \left (f x +e \right )} A}{80 c^{5} f}-\frac {{\mathrm e}^{8 i \left (f x +e \right )} B \,a^{2}}{64 c^{5} f}-\frac {3 i {\mathrm e}^{8 i \left (f x +e \right )} A \,a^{2}}{64 c^{5} f}+\frac {{\mathrm e}^{6 i \left (f x +e \right )} B \,a^{2}}{48 c^{5} f}-\frac {i {\mathrm e}^{6 i \left (f x +e \right )} A \,a^{2}}{16 c^{5} f}+\frac {a^{2} {\mathrm e}^{4 i \left (f x +e \right )} B}{32 c^{5} f}-\frac {i a^{2} {\mathrm e}^{4 i \left (f x +e \right )} A}{32 c^{5} f}\) \(174\)
norman \(\frac {\frac {A \,a^{2} \tan \left (f x +e \right )}{c f}+\frac {-9 i A \,a^{2}+B \,a^{2}}{60 c f}-\frac {\left (-7 i B \,a^{2}+12 A \,a^{2}\right ) \tan \left (f x +e \right )^{3}}{3 c f}+\frac {\left (i A \,a^{2}+7 B \,a^{2}\right ) \tan \left (f x +e \right )^{6}}{4 c f}+\frac {7 \left (-8 i B \,a^{2}+3 A \,a^{2}\right ) \tan \left (f x +e \right )^{5}}{15 c f}+\frac {\left (33 i A \,a^{2}+7 B \,a^{2}\right ) \tan \left (f x +e \right )^{2}}{12 c f}-\frac {\left (39 i A \,a^{2}+49 B \,a^{2}\right ) \tan \left (f x +e \right )^{4}}{12 c f}+\frac {i B \,a^{2} \tan \left (f x +e \right )^{7}}{3 c f}}{\left (1+\tan \left (f x +e \right )^{2}\right )^{5} c^{4}}\) \(227\)

Input:

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^5,x,method=_R 
ETURNVERBOSE)
 

Output:

1/f*a^2/c^5*(-1/4*(-I*A-3*B)/(I+tan(f*x+e))^4-1/5*(-2*A+2*I*B)/(I+tan(f*x+ 
e))^5+1/3*I*B/(I+tan(f*x+e))^3)
 

Fricas [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.94 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=-\frac {12 \, {\left (i \, A + B\right )} a^{2} e^{\left (10 i \, f x + 10 i \, e\right )} + 15 \, {\left (3 i \, A + B\right )} a^{2} e^{\left (8 i \, f x + 8 i \, e\right )} + 20 \, {\left (3 i \, A - B\right )} a^{2} e^{\left (6 i \, f x + 6 i \, e\right )} + 30 \, {\left (i \, A - B\right )} a^{2} e^{\left (4 i \, f x + 4 i \, e\right )}}{960 \, c^{5} f} \] Input:

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^5,x, al 
gorithm="fricas")
 

Output:

-1/960*(12*(I*A + B)*a^2*e^(10*I*f*x + 10*I*e) + 15*(3*I*A + B)*a^2*e^(8*I 
*f*x + 8*I*e) + 20*(3*I*A - B)*a^2*e^(6*I*f*x + 6*I*e) + 30*(I*A - B)*a^2* 
e^(4*I*f*x + 4*I*e))/(c^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. 332 vs. \(2 (76) = 152\).

Time = 0.41 (sec) , antiderivative size = 332, normalized size of antiderivative = 3.49 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=\begin {cases} \frac {\left (- 245760 i A a^{2} c^{15} f^{3} e^{4 i e} + 245760 B a^{2} c^{15} f^{3} e^{4 i e}\right ) e^{4 i f x} + \left (- 491520 i A a^{2} c^{15} f^{3} e^{6 i e} + 163840 B a^{2} c^{15} f^{3} e^{6 i e}\right ) e^{6 i f x} + \left (- 368640 i A a^{2} c^{15} f^{3} e^{8 i e} - 122880 B a^{2} c^{15} f^{3} e^{8 i e}\right ) e^{8 i f x} + \left (- 98304 i A a^{2} c^{15} f^{3} e^{10 i e} - 98304 B a^{2} c^{15} f^{3} e^{10 i e}\right ) e^{10 i f x}}{7864320 c^{20} f^{4}} & \text {for}\: c^{20} f^{4} \neq 0 \\\frac {x \left (A a^{2} e^{10 i e} + 3 A a^{2} e^{8 i e} + 3 A a^{2} e^{6 i e} + A a^{2} e^{4 i e} - i B a^{2} e^{10 i e} - i B a^{2} e^{8 i e} + i B a^{2} e^{6 i e} + i B a^{2} e^{4 i e}\right )}{8 c^{5}} & \text {otherwise} \end {cases} \] Input:

integrate((a+I*a*tan(f*x+e))**2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**5,x)
 

Output:

Piecewise((((-245760*I*A*a**2*c**15*f**3*exp(4*I*e) + 245760*B*a**2*c**15* 
f**3*exp(4*I*e))*exp(4*I*f*x) + (-491520*I*A*a**2*c**15*f**3*exp(6*I*e) + 
163840*B*a**2*c**15*f**3*exp(6*I*e))*exp(6*I*f*x) + (-368640*I*A*a**2*c**1 
5*f**3*exp(8*I*e) - 122880*B*a**2*c**15*f**3*exp(8*I*e))*exp(8*I*f*x) + (- 
98304*I*A*a**2*c**15*f**3*exp(10*I*e) - 98304*B*a**2*c**15*f**3*exp(10*I*e 
))*exp(10*I*f*x))/(7864320*c**20*f**4), Ne(c**20*f**4, 0)), (x*(A*a**2*exp 
(10*I*e) + 3*A*a**2*exp(8*I*e) + 3*A*a**2*exp(6*I*e) + A*a**2*exp(4*I*e) - 
 I*B*a**2*exp(10*I*e) - I*B*a**2*exp(8*I*e) + I*B*a**2*exp(6*I*e) + I*B*a* 
*2*exp(4*I*e))/(8*c**5), True))
 

Maxima [F(-2)]

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

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^5,x, al 
gorithm="maxima")
 

Output:

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

Giac [A] (verification not implemented)

Time = 0.56 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.73 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=-\frac {-20 i \, B a^{2} \tan \left (f x + e\right )^{2} - 15 i \, A a^{2} \tan \left (f x + e\right ) - 5 \, B a^{2} \tan \left (f x + e\right ) - 9 \, A a^{2} - i \, B a^{2}}{60 \, c^{5} f {\left (\tan \left (f x + e\right ) + i\right )}^{5}} \] Input:

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^5,x, al 
gorithm="giac")
 

Output:

-1/60*(-20*I*B*a^2*tan(f*x + e)^2 - 15*I*A*a^2*tan(f*x + e) - 5*B*a^2*tan( 
f*x + e) - 9*A*a^2 - I*B*a^2)/(c^5*f*(tan(f*x + e) + I)^5)
 

Mupad [B] (verification not implemented)

Time = 5.47 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.14 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^5} \, dx=\frac {\frac {a^2\,\left (9\,A+B\,1{}\mathrm {i}\right )}{60}+\frac {a^2\,\mathrm {tan}\left (e+f\,x\right )\,\left (5\,B+A\,15{}\mathrm {i}\right )}{60}+\frac {B\,a^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}}{3}}{c^5\,f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^5+{\mathrm {tan}\left (e+f\,x\right )}^4\,5{}\mathrm {i}-10\,{\mathrm {tan}\left (e+f\,x\right )}^3-{\mathrm {tan}\left (e+f\,x\right )}^2\,10{}\mathrm {i}+5\,\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )} \] Input:

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^2)/(c - c*tan(e + f*x)*1 
i)^5,x)
 

Output:

((a^2*(9*A + B*1i))/60 + (a^2*tan(e + f*x)*(A*15i + 5*B))/60 + (B*a^2*tan( 
e + f*x)^2*1i)/3)/(c^5*f*(5*tan(e + f*x) - tan(e + f*x)^2*10i - 10*tan(e + 
 f*x)^3 + tan(e + f*x)^4*5i + tan(e + f*x)^5 + 1i))
 

Reduce [F]

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

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^5,x)
 

Output:

(a**2*( - int(tan(e + f*x)**3/(tan(e + f*x)**5 + 5*tan(e + f*x)**4*i - 10* 
tan(e + f*x)**3 - 10*tan(e + f*x)**2*i + 5*tan(e + f*x) + i),x)*b*i - int( 
tan(e + f*x)**2/(tan(e + f*x)**5 + 5*tan(e + f*x)**4*i - 10*tan(e + f*x)** 
3 - 10*tan(e + f*x)**2*i + 5*tan(e + f*x) + i),x)*a*i - 2*int(tan(e + f*x) 
**2/(tan(e + f*x)**5 + 5*tan(e + f*x)**4*i - 10*tan(e + f*x)**3 - 10*tan(e 
 + f*x)**2*i + 5*tan(e + f*x) + i),x)*b - 2*int(tan(e + f*x)/(tan(e + f*x) 
**5 + 5*tan(e + f*x)**4*i - 10*tan(e + f*x)**3 - 10*tan(e + f*x)**2*i + 5* 
tan(e + f*x) + i),x)*a + int(tan(e + f*x)/(tan(e + f*x)**5 + 5*tan(e + f*x 
)**4*i - 10*tan(e + f*x)**3 - 10*tan(e + f*x)**2*i + 5*tan(e + f*x) + i),x 
)*b*i + int(1/(tan(e + f*x)**5 + 5*tan(e + f*x)**4*i - 10*tan(e + f*x)**3 
- 10*tan(e + f*x)**2*i + 5*tan(e + f*x) + i),x)*a*i))/c**5