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

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 = 26, antiderivative size = 139 \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^3 \, dx=\frac {i a^3 d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac {d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}-\frac {4 i a^3 d^2 (d \cot (e+f x))^{-2+n} \operatorname {Hypergeometric2F1}(1,-2+n,-1+n,-i \cot (e+f x))}{f (2-n)} \] Output:

I*a^3*d^2*(1-2*n)*(d*cot(f*x+e))^(-2+n)/f/(1-n)/(2-n)+d^2*(d*cot(f*x+e))^( 
-2+n)*(I*a^3+a^3*cot(f*x+e))/f/(1-n)-4*I*a^3*d^2*(d*cot(f*x+e))^(-2+n)*hyp 
ergeom([1, -2+n],[-1+n],-I*cot(f*x+e))/f/(2-n)
 

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.85 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.05, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.423, Rules used = {3042, 4156, 3042, 4039, 3042, 4075, 3042, 4020, 25, 27, 74}

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 (d \cot (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4156

\(\displaystyle d^3 \int (d \cot (e+f x))^{n-3} (\cot (e+f x) a+i a)^3dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4039

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4075

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4020

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 74

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

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]
 

rule 4156
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x 
_)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p)   Int[(d*Cot[e + f*x])^(m - n*p 
)*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && 
  !IntegerQ[m] && IntegersQ[n, p]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

integral(8*a^3*((I*d*e^(2*I*f*x + 2*I*e) + 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 (d \cot (e+f x))^n (a+i a \tan (e+f x))^3 \, dx=- i a^{3} \left (\int i \left (d \cot {\left (e + f x \right )}\right )^{n}\, dx + \int \left (- 3 \left (d \cot {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx + \int \left (d \cot {\left (e + f x \right )}\right )^{n} \tan ^{3}{\left (e + f x \right )}\, dx + \int \left (- 3 i \left (d \cot {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx\right ) \] Input:

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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