\(\int (d \cot (e+f x))^n (a+b \tan (e+f x)) \, dx\) [882]

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

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

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.92 \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x)) \, dx=-\frac {(d \cot (e+f x))^n \left (b (1+n) \operatorname {Hypergeometric2F1}\left (1,\frac {n}{2},\frac {2+n}{2},-\cot ^2(e+f x)\right )+a n \cot (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\cot ^2(e+f x)\right )\right )}{f n (1+n)} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.43 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.05, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4156, 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 (a+b \tan (e+f x)) (d \cot (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4156

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4021

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3957

\(\displaystyle d \left (-\frac {a \int \frac {(d \cot (e+f x))^n}{\cot ^2(e+f x) d^2+d^2}d(d \cot (e+f x))}{f}-\frac {b d \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}\right )\)

\(\Big \downarrow \) 278

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

Input:

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

Output:

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

Defintions of rubi rules used

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 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 +b \tan \left (f x +e \right )\right )d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

integral((b*tan(f*x + e) + a)*(d*cot(f*x + e))^n, x)
 

Sympy [F]

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

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

Output:

Integral((d*cot(e + f*x))**n*(a + b*tan(e + f*x)), x)
 

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

d**n*(int(cot(e + f*x)**n,x)*a + int(cot(e + f*x)**n*tan(e + f*x),x)*b)