\(\int \frac {(c (d \tan (e+f x))^p)^n}{(a+i a \tan (e+f x))^2} \, dx\) [1338]

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.47 (sec) , antiderivative size = 215, normalized size of antiderivative = 0.86, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4853, 27, 2003, 2042, 114, 168, 27, 174, 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 \frac {\left (c (d \tan (e+f x))^p\right )^n}{(a+i a \tan (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4853

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 2003

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

\(\Big \downarrow \) 2042

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

\(\Big \downarrow \) 114

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

\(\Big \downarrow \) 168

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 174

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

\(\Big \downarrow \) 74

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

Input:

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

Output:

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

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 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 114
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_), x_] :> Simp[b*(a + b*x)^(m + 1)*(c + d*x)^(n + 1)*((e + f*x)^(p + 1 
)/((m + 1)*(b*c - a*d)*(b*e - a*f))), x] + Simp[1/((m + 1)*(b*c - a*d)*(b*e 
 - a*f))   Int[(a + b*x)^(m + 1)*(c + d*x)^n*(e + f*x)^p*Simp[a*d*f*(m + 1) 
 - b*(d*e*(m + n + 2) + c*f*(m + p + 2)) - b*d*f*(m + n + p + 3)*x, x], x], 
 x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && ILtQ[m, -1] && (IntegerQ[n] || 
 IntegersQ[2*n, 2*p] || ILtQ[m + n + p + 3, 0])
 

rule 168
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_)*((g_.) + (h_.)*(x_)), x_] :> Simp[(b*g - a*h)*(a + b*x)^(m + 1)*(c + 
 d*x)^(n + 1)*((e + f*x)^(p + 1)/((m + 1)*(b*c - a*d)*(b*e - a*f))), x] + S 
imp[1/((m + 1)*(b*c - a*d)*(b*e - a*f))   Int[(a + b*x)^(m + 1)*(c + d*x)^n 
*(e + f*x)^p*Simp[(a*d*f*g - b*(d*e + c*f)*g + b*c*e*h)*(m + 1) - (b*g - a* 
h)*(d*e*(n + 1) + c*f*(p + 1)) - d*f*(b*g - a*h)*(m + n + p + 3)*x, x], x], 
 x] /; FreeQ[{a, b, c, d, e, f, g, h, n, p}, x] && ILtQ[m, -1]
 

rule 174
Int[(((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)))/(((a_.) + (b_.)*(x_))* 
((c_.) + (d_.)*(x_))), x_] :> Simp[(b*g - a*h)/(b*c - a*d)   Int[(e + f*x)^ 
p/(a + b*x), x], x] - Simp[(d*g - c*h)/(b*c - a*d)   Int[(e + f*x)^p/(c + d 
*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x]
 

rule 2003
Int[(u_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] : 
> Int[u*(c + d*x)^(n + p)*(a/c + (b/d)*x)^p, x] /; FreeQ[{a, b, c, d, n, p} 
, x] && EqQ[b*c^2 + a*d^2, 0] && (IntegerQ[p] || (GtQ[a, 0] && GtQ[c, 0] && 
  !IntegerQ[n]))
 

rule 2042
Int[(u_.)*((c_.)*((d_)*((a_.) + (b_.)*(x_)))^(q_))^(p_), x_Symbol] :> Simp[ 
(c*(d*(a + b*x))^q)^p/(a + b*x)^(p*q)   Int[u*(a + b*x)^(p*q), x], x] /; Fr 
eeQ[{a, b, c, d, q, p}, x] &&  !IntegerQ[q] &&  !IntegerQ[p]
 

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

rule 4853
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, Simp[With[{d = FreeFa 
ctors[Tan[v], x]}, d/Coefficient[v, x, 1]   Subst[Int[SubstFor[1/(1 + d^2*x 
^2), Tan[v]/d, u, x], x], x, Tan[v]/d]], x] /;  !FalseQ[v] && FunctionOfQ[N 
onfreeFactors[Tan[v], x], u, x, True] && TryPureTanSubst[ActivateTrig[u], x 
]]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

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

integrate((c*(d*tan(f*x+e))**p)**n/(a+I*a*tan(f*x+e))**2,x)
 

Output:

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

Maxima [F(-2)]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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