\(\int \frac {(d \cot (e+f x))^n}{a+i a \tan (e+f x)} \, dx\) [791]

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

Optimal result

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.67 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.02, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {3042, 4156, 3042, 4035, 25, 3042, 4021, 3042, 3957, 278}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4156

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4035

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4021

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3957

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

\(\Big \downarrow \) 278

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

Input:

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

Output:

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

Defintions of rubi rules used

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

rule 278
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( 
c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( 
-b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] &&  !IGtQ[p, 0] && (ILtQ[p, 0 
] || GtQ[a, 0])
 

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

rule 3957
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d   Subst[Int 
[x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && 
!IntegerQ[n]
 

rule 4021
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 
2 + d^2, 0] &&  !IntegerQ[2*m]
 

rule 4035
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[(-a)*((c + d*Tan[e + f*x])^(n + 1)/(2*f*(b* 
c - a*d)*(a + b*Tan[e + f*x]))), x] + Simp[1/(2*a*(b*c - a*d))   Int[(c + d 
*Tan[e + f*x])^n*Simp[b*c + a*d*(n - 1) - b*d*n*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] &&  !GtQ[n, 0]
 

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 \frac {\left (d \cot \left (f x +e \right )\right )^{n}}{a +i a \tan \left (f x +e \right )}d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

integral(1/2*((I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) - 1))^n 
*(e^(2*I*f*x + 2*I*e) + 1)*e^(-2*I*f*x - 2*I*e)/a, x)
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

Exception generated. \[ \int \frac {(d \cot (e+f x))^n}{a+i a \tan (e+f x)} \, dx=\text {Exception raised: RuntimeError} \] Input:

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

Output:

Exception raised: RuntimeError >> ECL says: THROW: The catch RAT-ERR is un 
defined.
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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