Integrand size = 30, antiderivative size = 74 \[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=-\frac {i \operatorname {Hypergeometric2F1}\left (2,-1-n,-n,\frac {1}{2} (1-i \tan (c+d x))\right ) (e \sec (c+d x))^{-2 (1+n)} (a+i a \tan (c+d x))^{1+n}}{4 a d (1+n)} \] Output:
-1/4*I*hypergeom([2, -1-n],[-n],1/2-1/2*I*tan(d*x+c))*(a+I*a*tan(d*x+c))^( 1+n)/a/d/(1+n)/((e*sec(d*x+c))^(2+2*n))
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(151\) vs. \(2(74)=148\).
Time = 9.90 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.04 \[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=-\frac {i 2^{-3-n} \left (e^{i d x}\right )^n \left (\frac {e^{i (c+d x)}}{1+e^{2 i (c+d x)}}\right )^{-n} \left (1+e^{2 i (c+d x)}\right )^3 \operatorname {Hypergeometric2F1}\left (2,3+n,4+n,1+e^{2 i (c+d x)}\right ) \sec ^n(c+d x) (e \sec (c+d x))^{-2 n} (\cos (d x)+i \sin (d x))^{-n} (a+i a \tan (c+d x))^n}{d e^2 (3+n)} \] Input:
Integrate[(e*Sec[c + d*x])^(-2 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]
Output:
((-I)*2^(-3 - n)*(E^(I*d*x))^n*(1 + E^((2*I)*(c + d*x)))^3*Hypergeometric2 F1[2, 3 + n, 4 + n, 1 + E^((2*I)*(c + d*x))]*Sec[c + d*x]^n*(a + I*a*Tan[c + d*x])^n)/(d*e^2*(E^(I*(c + d*x))/(1 + E^((2*I)*(c + d*x))))^n*(3 + n)*( e*Sec[c + d*x])^(2*n)*(Cos[d*x] + I*Sin[d*x])^n)
Time = 0.57 (sec) , antiderivative size = 78, 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.233, Rules used = {3042, 3986, 3042, 4005, 3042, 3968, 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 (c+d x))^n (e \sec (c+d x))^{-2 n-2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (c+d x))^n (e \sec (c+d x))^{-2 n-2}dx\) |
\(\Big \downarrow \) 3986 |
\(\displaystyle (a-i a \tan (c+d x))^{n+1} (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \int \frac {(a-i a \tan (c+d x))^{-n-1}}{i \tan (c+d x) a+a}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle (a-i a \tan (c+d x))^{n+1} (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \int \frac {(a-i a \tan (c+d x))^{-n-1}}{i \tan (c+d x) a+a}dx\) |
\(\Big \downarrow \) 4005 |
\(\displaystyle \frac {(a-i a \tan (c+d x))^{n+1} (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \int \cos ^2(c+d x) (a-i a \tan (c+d x))^{-n}dx}{a^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {(a-i a \tan (c+d x))^{n+1} (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \int \frac {(a-i a \tan (c+d x))^{-n}}{\sec (c+d x)^2}dx}{a^2}\) |
\(\Big \downarrow \) 3968 |
\(\displaystyle \frac {i a (a-i a \tan (c+d x))^{n+1} (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \int \frac {(a-i a \tan (c+d x))^{-n-2}}{(i \tan (c+d x) a+a)^2}d(-i a \tan (c+d x))}{d}\) |
\(\Big \downarrow \) 78 |
\(\displaystyle -\frac {i (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-2 (n+1)} \operatorname {Hypergeometric2F1}\left (2,-n-1,-n,\frac {a-i a \tan (c+d x)}{2 a}\right )}{4 a d (n+1)}\) |
Input:
Int[(e*Sec[c + d*x])^(-2 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]
Output:
((-1/4*I)*Hypergeometric2F1[2, -1 - n, -n, (a - I*a*Tan[c + d*x])/(2*a)]*( a + I*a*Tan[c + d*x])^(1 + n))/(a*d*(1 + n)*(e*Sec[c + d*x])^(2*(1 + n)))
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]
Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ ), x_Symbol] :> Simp[1/(a^(m - 2)*b*f) Subst[Int[(a - x)^(m/2 - 1)*(a + x )^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*( x_)])^(n_.), x_Symbol] :> Simp[(d*Sec[e + f*x])^m/((a + b*Tan[e + f*x])^(m/ 2)*(a - b*Tan[e + f*x])^(m/2)) Int[(a + b*Tan[e + f*x])^(m/2 + n)*(a - b* Tan[e + f*x])^(m/2), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0]
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Simp[a^m*c^m Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && EqQ[ b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] && !(IGtQ[n, 0] && (LtQ[ m, 0] || GtQ[m, n]))
\[\int \left (e \sec \left (d x +c \right )\right )^{-2 n -2} \left (a +i a \tan \left (d x +c \right )\right )^{n}d x\]
Input:
int((e*sec(d*x+c))^(-2*n-2)*(a+I*a*tan(d*x+c))^n,x)
Output:
int((e*sec(d*x+c))^(-2*n-2)*(a+I*a*tan(d*x+c))^n,x)
\[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\int { \left (e \sec \left (d x + c\right )\right )^{-2 \, n - 2} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \,d x } \] Input:
integrate((e*sec(d*x+c))^(-2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="frica s")
Output:
integral((2*e*e^(I*d*x + I*c)/(e^(2*I*d*x + 2*I*c) + 1))^(-2*n - 2)*e^(I*d *n*x + I*c*n + n*log(2*e*e^(I*d*x + I*c)/(e^(2*I*d*x + 2*I*c) + 1)) + n*lo g(a/e)), x)
\[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\int \left (e \sec {\left (c + d x \right )}\right )^{- 2 n - 2} \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n}\, dx \] Input:
integrate((e*sec(d*x+c))**(-2-2*n)*(a+I*a*tan(d*x+c))**n,x)
Output:
Integral((e*sec(c + d*x))**(-2*n - 2)*(I*a*(tan(c + d*x) - I))**n, x)
\[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\int { \left (e \sec \left (d x + c\right )\right )^{-2 \, n - 2} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \,d x } \] Input:
integrate((e*sec(d*x+c))^(-2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="maxim a")
Output:
integrate((e*sec(d*x + c))^(-2*n - 2)*(I*a*tan(d*x + c) + a)^n, x)
\[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\int { \left (e \sec \left (d x + c\right )\right )^{-2 \, n - 2} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \,d x } \] Input:
integrate((e*sec(d*x+c))^(-2-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="giac" )
Output:
integrate((e*sec(d*x + c))^(-2*n - 2)*(I*a*tan(d*x + c) + a)^n, x)
Timed out. \[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\int \frac {{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^n}{{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{2\,n+2}} \,d x \] Input:
int((a + a*tan(c + d*x)*1i)^n/(e/cos(c + d*x))^(2*n + 2),x)
Output:
int((a + a*tan(c + d*x)*1i)^n/(e/cos(c + d*x))^(2*n + 2), x)
\[ \int (e \sec (c+d x))^{-2-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {\int \frac {\left (\tan \left (d x +c \right ) a i +a \right )^{n}}{\sec \left (d x +c \right )^{2 n} \sec \left (d x +c \right )^{2}}d x}{e^{2 n} e^{2}} \] Input:
int((e*sec(d*x+c))^(-2-2*n)*(a+I*a*tan(d*x+c))^n,x)
Output:
int((tan(c + d*x)*a*i + a)**n/(sec(c + d*x)**(2*n)*sec(c + d*x)**2),x)/(e* *(2*n)*e**2)