\(\int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^n \, dx\) [1174]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

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

a^3*(I*c-d*(5+2*n))*(c+d*tan(f*x+e))^(1+n)/d^2/f/(1+n)/(2+n)+4*a^3*hyperge 
om([1, 1+n],[2+n],(c+d*tan(f*x+e))/(c-I*d))*(c+d*tan(f*x+e))^(1+n)/(I*c+d) 
/f/(1+n)-(a^3+I*a^3*tan(f*x+e))*(c+d*tan(f*x+e))^(1+n)/d/f/(2+n)
 

Mathematica [A] (verified)

Time = 1.19 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.71 \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^n \, dx=-\frac {a^3 (c+d \tan (e+f x))^{1+n} \left (-4 d^2 (2+n) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {c+d \tan (e+f x)}{c-i d}\right )+(c-i d) (c+3 i d (2+n)-d (1+n) \tan (e+f x))\right )}{d^2 (i c+d) f (1+n) (2+n)} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.75 (sec) , antiderivative size = 183, normalized size of antiderivative = 1.17, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4039, 3042, 4075, 3042, 4020, 27, 78}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^ndx\)

\(\Big \downarrow \) 4039

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4075

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4020

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 78

\(\displaystyle \frac {a \left (\frac {a^2 (i c-2 d n-5 d) (c+d \tan (e+f x))^{n+1}}{d f (n+1)}-\frac {4 i a^2 d (n+2) (c+d \tan (e+f x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {4 c a^2+4 d \tan (e+f x) a^2}{4 a^2 (c-i d)}\right )}{f (n+1) (c-i d)}\right )}{d (n+2)}-\frac {\left (a^3+i a^3 \tan (e+f x)\right ) (c+d \tan (e+f x))^{n+1}}{d f (n+2)}\)

Input:

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

Output:

-(((a^3 + I*a^3*Tan[e + f*x])*(c + d*Tan[e + f*x])^(1 + n))/(d*f*(2 + n))) 
 + (a*((a^2*(I*c - 5*d - 2*d*n)*(c + d*Tan[e + f*x])^(1 + n))/(d*f*(1 + n) 
) - ((4*I)*a^2*d*(2 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (4*a^2*c + 4*a 
^2*d*Tan[e + f*x])/(4*a^2*(c - I*d))]*(c + d*Tan[e + f*x])^(1 + n))/((c - 
I*d)*f*(1 + n))))/(d*(2 + n))
 

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 78
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b 
*c - a*d)^n*((a + b*x)^(m + 1)/(b^(n + 1)*(m + 1)))*Hypergeometric2F1[-n, m 
 + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m}, x] 
 &&  !IntegerQ[m] && IntegerQ[n]
 

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

rule 4020
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[c*(d/f)   Subst[Int[(a + (b/d)*x)^m/(d^2 + 
c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[ 
b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 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 4075
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B 
*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* 
x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1]
 
Maple [F]

\[\int \left (a +i a \tan \left (f x +e \right )\right )^{3} \left (c +d \tan \left (f x +e \right )\right )^{n}d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

integral(8*a^3*(((c - I*d)*e^(2*I*f*x + 2*I*e) + c + I*d)/(e^(2*I*f*x + 2* 
I*e) + 1))^n*e^(6*I*f*x + 6*I*e)/(e^(6*I*f*x + 6*I*e) + 3*e^(4*I*f*x + 4*I 
*e) + 3*e^(2*I*f*x + 2*I*e) + 1), x)
 

Sympy [F]

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

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

Output:

-I*a**3*(Integral(I*(c + d*tan(e + f*x))**n, x) + Integral(-3*(c + d*tan(e 
 + f*x))**n*tan(e + f*x), x) + Integral((c + d*tan(e + f*x))**n*tan(e + f* 
x)**3, x) + Integral(-3*I*(c + d*tan(e + f*x))**n*tan(e + f*x)**2, x))
 

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

Timed out. \[ \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^n \, dx=\int {\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^3\,{\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n \,d x \] Input:

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

Output:

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

Reduce [F]

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

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

Output:

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