\(\int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx\) [1051]

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

Optimal result

Integrand size = 31, antiderivative size = 134 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=-\frac {8 i c^4 (a+i a \tan (e+f x))^m}{f m}+\frac {12 i c^4 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}-\frac {6 i c^4 (a+i a \tan (e+f x))^{2+m}}{a^2 f (2+m)}+\frac {i c^4 (a+i a \tan (e+f x))^{3+m}}{a^3 f (3+m)} \] Output:

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

Mathematica [A] (verified)

Time = 1.28 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.78 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=-\frac {i c^4 (a+i a \tan (e+f x))^m \left (\frac {8 a^3}{m}-\frac {12 i a^3 (-i+\tan (e+f x))}{1+m}+\frac {6 a (a+i a \tan (e+f x))^2}{2+m}-\frac {(a+i a \tan (e+f x))^3}{3+m}\right )}{a^3 f} \] Input:

Integrate[(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^4,x]
 

Output:

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

Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.84, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3042, 4005, 3042, 3968, 53, 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 (c-i c \tan (e+f x))^4 (a+i a \tan (e+f x))^m \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c-i c \tan (e+f x))^4 (a+i a \tan (e+f x))^mdx\)

\(\Big \downarrow \) 4005

\(\displaystyle a^4 c^4 \int \sec ^8(e+f x) (i \tan (e+f x) a+a)^{m-4}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle a^4 c^4 \int \sec (e+f x)^8 (i \tan (e+f x) a+a)^{m-4}dx\)

\(\Big \downarrow \) 3968

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

\(\Big \downarrow \) 53

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

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {i c^4 \left (\frac {8 a^3 (a+i a \tan (e+f x))^m}{m}-\frac {12 a^2 (a+i a \tan (e+f x))^{m+1}}{m+1}+\frac {6 a (a+i a \tan (e+f x))^{m+2}}{m+2}-\frac {(a+i a \tan (e+f x))^{m+3}}{m+3}\right )}{a^3 f}\)

Input:

Int[(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^4,x]
 

Output:

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

Defintions of rubi rules used

rule 53
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int 
[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, 
x] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0] && LeQ[7*m + 4*n + 4, 0]) 
|| LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])
 

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 3968
Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ 
), x_Symbol] :> Simp[1/(a^(m - 2)*b*f)   Subst[Int[(a - x)^(m/2 - 1)*(a + x 
)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && 
 EqQ[a^2 + b^2, 0] && IntegerQ[m/2]
 

rule 4005
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_.), x_Symbol] :> Simp[a^m*c^m   Int[Sec[e + f*x]^(2*m)*(c + 
 d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && EqQ[ 
b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[ 
m, 0] || GtQ[m, n]))
 
Maple [A] (verified)

Time = 1.00 (sec) , antiderivative size = 204, normalized size of antiderivative = 1.52

method result size
derivativedivides \(\frac {c^{4} \tan \left (f x +e \right )^{3} {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (3+m \right )}-\frac {3 c^{4} \left (m^{2}+7 m +14\right ) \tan \left (f x +e \right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (m^{2}+3 m +2\right ) \left (3+m \right )}-\frac {i \left (c^{4} m^{3}+9 c^{4} m^{2}+32 c^{4} m +48 c^{4}\right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{\left (m^{2}+3 m +2\right ) f m \left (3+m \right )}+\frac {3 i \left (4+m \right ) c^{4} \tan \left (f x +e \right )^{2} {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (3+m \right ) \left (2+m \right )}\) \(204\)
default \(\frac {c^{4} \tan \left (f x +e \right )^{3} {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (3+m \right )}-\frac {3 c^{4} \left (m^{2}+7 m +14\right ) \tan \left (f x +e \right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (m^{2}+3 m +2\right ) \left (3+m \right )}-\frac {i \left (c^{4} m^{3}+9 c^{4} m^{2}+32 c^{4} m +48 c^{4}\right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{\left (m^{2}+3 m +2\right ) f m \left (3+m \right )}+\frac {3 i \left (4+m \right ) c^{4} \tan \left (f x +e \right )^{2} {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (3+m \right ) \left (2+m \right )}\) \(204\)
risch \(\text {Expression too large to display}\) \(4839\)

Input:

int((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^4,x,method=_RETURNVERBOSE)
 

Output:

c^4/f/(3+m)*tan(f*x+e)^3*exp(m*ln(a+I*a*tan(f*x+e)))-3*c^4*(m^2+7*m+14)/f/ 
(m^2+3*m+2)/(3+m)*tan(f*x+e)*exp(m*ln(a+I*a*tan(f*x+e)))-I/(m^2+3*m+2)/f/m 
*(c^4*m^3+9*c^4*m^2+32*c^4*m+48*c^4)/(3+m)*exp(m*ln(a+I*a*tan(f*x+e)))+3*I 
*(4+m)*c^4/f/(3+m)/(2+m)*tan(f*x+e)^2*exp(m*ln(a+I*a*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. 247 vs. \(2 (118) = 236\).

Time = 0.11 (sec) , antiderivative size = 247, normalized size of antiderivative = 1.84 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=-\frac {8 \, {\left (i \, c^{4} m^{3} + 6 i \, c^{4} m^{2} + 11 i \, c^{4} m + 6 i \, c^{4} e^{\left (6 i \, f x + 6 i \, e\right )} + 6 i \, c^{4} + 6 \, {\left (i \, c^{4} m + 3 i \, c^{4}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (i \, c^{4} m^{2} + 5 i \, c^{4} m + 6 i \, c^{4}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac {2 \, a e^{\left (2 i \, f x + 2 i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{m}}{f m^{4} + 6 \, f m^{3} + 11 \, f m^{2} + 6 \, f m + {\left (f m^{4} + 6 \, f m^{3} + 11 \, f m^{2} + 6 \, f m\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (f m^{4} + 6 \, f m^{3} + 11 \, f m^{2} + 6 \, f m\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (f m^{4} + 6 \, f m^{3} + 11 \, f m^{2} + 6 \, f m\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \] Input:

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^4,x, algorithm="fricas")
 

Output:

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

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. 2225 vs. \(2 (110) = 220\).

Time = 1.55 (sec) , antiderivative size = 2225, normalized size of antiderivative = 16.60 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=\text {Too large to display} \] Input:

integrate((a+I*a*tan(f*x+e))**m*(c-I*c*tan(f*x+e))**4,x)
 

Output:

Piecewise((x*(I*a*tan(e) + a)**m*(-I*c*tan(e) + c)**4, Eq(f, 0)), (-6*c**4 
*f*x*tan(e + f*x)**3/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)* 
*2 - 18*a**3*f*tan(e + f*x) + 6*I*a**3*f) + 18*I*c**4*f*x*tan(e + f*x)**2/ 
(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f*tan(e 
+ f*x) + 6*I*a**3*f) + 18*c**4*f*x*tan(e + f*x)/(6*a**3*f*tan(e + f*x)**3 
- 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f*tan(e + f*x) + 6*I*a**3*f) - 6*I 
*c**4*f*x/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a** 
3*f*tan(e + f*x) + 6*I*a**3*f) + 3*I*c**4*log(tan(e + f*x)**2 + 1)*tan(e + 
 f*x)**3/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3 
*f*tan(e + f*x) + 6*I*a**3*f) + 9*c**4*log(tan(e + f*x)**2 + 1)*tan(e + f* 
x)**2/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f* 
tan(e + f*x) + 6*I*a**3*f) - 9*I*c**4*log(tan(e + f*x)**2 + 1)*tan(e + f*x 
)/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f*tan( 
e + f*x) + 6*I*a**3*f) - 3*c**4*log(tan(e + f*x)**2 + 1)/(6*a**3*f*tan(e + 
 f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f*tan(e + f*x) + 6*I*a**3 
*f) + 36*c**4*tan(e + f*x)**2/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan( 
e + f*x)**2 - 18*a**3*f*tan(e + f*x) + 6*I*a**3*f) - 36*I*c**4*tan(e + f*x 
)/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*tan(e + f*x)**2 - 18*a**3*f*tan( 
e + f*x) + 6*I*a**3*f) - 16*c**4/(6*a**3*f*tan(e + f*x)**3 - 18*I*a**3*f*t 
an(e + f*x)**2 - 18*a**3*f*tan(e + f*x) + 6*I*a**3*f), Eq(m, -3)), (6*c...
 

Maxima [F]

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

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^4,x, algorithm="maxima")
 

Output:

integrate((-I*c*tan(f*x + e) + c)^4*(I*a*tan(f*x + e) + a)^m, x)
 

Giac [F]

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

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^4,x, algorithm="giac")
 

Output:

integrate((-I*c*tan(f*x + e) + c)^4*(I*a*tan(f*x + e) + a)^m, x)
 

Mupad [B] (verification not implemented)

Time = 6.73 (sec) , antiderivative size = 332, normalized size of antiderivative = 2.48 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=-\frac {4\,c^4\,{\left (\frac {a\,\left (\cos \left (2\,e+2\,f\,x\right )+1+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,e+2\,f\,x\right )+1}\right )}^m\,\left (\cos \left (2\,e+2\,f\,x\right )\,3{}\mathrm {i}+\cos \left (4\,e+4\,f\,x\right )\,3{}\mathrm {i}+\cos \left (6\,e+6\,f\,x\right )\,1{}\mathrm {i}+3\,\sin \left (2\,e+2\,f\,x\right )+3\,\sin \left (4\,e+4\,f\,x\right )+\sin \left (6\,e+6\,f\,x\right )+1{}\mathrm {i}\right )\,\left (11\,m+18\,\cos \left (2\,e+2\,f\,x\right )+18\,\cos \left (4\,e+4\,f\,x\right )+6\,\cos \left (6\,e+6\,f\,x\right )+15\,m\,\cos \left (2\,e+2\,f\,x\right )+6\,m\,\cos \left (4\,e+4\,f\,x\right )+6\,m^2+m^3+3\,m^2\,\cos \left (2\,e+2\,f\,x\right )+6+\sin \left (2\,e+2\,f\,x\right )\,18{}\mathrm {i}+\sin \left (4\,e+4\,f\,x\right )\,18{}\mathrm {i}+\sin \left (6\,e+6\,f\,x\right )\,6{}\mathrm {i}+m^2\,\sin \left (2\,e+2\,f\,x\right )\,3{}\mathrm {i}+m\,\sin \left (2\,e+2\,f\,x\right )\,15{}\mathrm {i}+m\,\sin \left (4\,e+4\,f\,x\right )\,6{}\mathrm {i}\right )}{f\,m\,\left (m^3+6\,m^2+11\,m+6\right )\,\left (15\,\cos \left (2\,e+2\,f\,x\right )+6\,\cos \left (4\,e+4\,f\,x\right )+\cos \left (6\,e+6\,f\,x\right )+10\right )} \] Input:

int((a + a*tan(e + f*x)*1i)^m*(c - c*tan(e + f*x)*1i)^4,x)
 

Output:

-(4*c^4*((a*(cos(2*e + 2*f*x) + sin(2*e + 2*f*x)*1i + 1))/(cos(2*e + 2*f*x 
) + 1))^m*(cos(2*e + 2*f*x)*3i + cos(4*e + 4*f*x)*3i + cos(6*e + 6*f*x)*1i 
 + 3*sin(2*e + 2*f*x) + 3*sin(4*e + 4*f*x) + sin(6*e + 6*f*x) + 1i)*(11*m 
+ 18*cos(2*e + 2*f*x) + 18*cos(4*e + 4*f*x) + 6*cos(6*e + 6*f*x) + sin(2*e 
 + 2*f*x)*18i + sin(4*e + 4*f*x)*18i + sin(6*e + 6*f*x)*6i + m^2*sin(2*e + 
 2*f*x)*3i + 15*m*cos(2*e + 2*f*x) + 6*m*cos(4*e + 4*f*x) + m*sin(2*e + 2* 
f*x)*15i + m*sin(4*e + 4*f*x)*6i + 6*m^2 + m^3 + 3*m^2*cos(2*e + 2*f*x) + 
6))/(f*m*(11*m + 6*m^2 + m^3 + 6)*(15*cos(2*e + 2*f*x) + 6*cos(4*e + 4*f*x 
) + cos(6*e + 6*f*x) + 10))
 

Reduce [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.23 \[ \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^4 \, dx=\frac {\left (\tan \left (f x +e \right ) a i +a \right )^{m} c^{4} \left (\tan \left (f x +e \right )^{3} m^{3}+3 \tan \left (f x +e \right )^{3} m^{2}+2 \tan \left (f x +e \right )^{3} m +3 \tan \left (f x +e \right )^{2} i \,m^{3}+15 \tan \left (f x +e \right )^{2} i \,m^{2}+12 \tan \left (f x +e \right )^{2} i m -3 \tan \left (f x +e \right ) m^{3}-21 \tan \left (f x +e \right ) m^{2}-42 \tan \left (f x +e \right ) m -i \,m^{3}-9 i \,m^{2}-32 i m -48 i \right )}{f m \left (m^{3}+6 m^{2}+11 m +6\right )} \] Input:

int((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^4,x)
 

Output:

((tan(e + f*x)*a*i + a)**m*c**4*(tan(e + f*x)**3*m**3 + 3*tan(e + f*x)**3* 
m**2 + 2*tan(e + f*x)**3*m + 3*tan(e + f*x)**2*i*m**3 + 15*tan(e + f*x)**2 
*i*m**2 + 12*tan(e + f*x)**2*i*m - 3*tan(e + f*x)*m**3 - 21*tan(e + f*x)*m 
**2 - 42*tan(e + f*x)*m - i*m**3 - 9*i*m**2 - 32*i*m - 48*i))/(f*m*(m**3 + 
 6*m**2 + 11*m + 6))