Integrand size = 32, antiderivative size = 92 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {2 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{f n (1+n)} \] Output:
I*a*(d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(1-n)/f/(1+n)+2*I*a^2*(d*sec(f *x+e))^(2*n)/f/n/(1+n)/((a+I*a*tan(f*x+e))^n)
Time = 1.89 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.66 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=-\frac {a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n} (-i (2+n)+n \tan (e+f x))}{f n (1+n)} \] Input:
Integrate[(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(2 - n),x]
Output:
-((a^2*(d*Sec[e + f*x])^(2*n)*((-I)*(2 + n) + n*Tan[e + f*x]))/(f*n*(1 + n )*(a + I*a*Tan[e + f*x])^n))
Time = 0.42 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3042, 3975, 3042, 3974}
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))^{2-n} (d \sec (e+f x))^{2 n} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (e+f x))^{2-n} (d \sec (e+f x))^{2 n}dx\) |
\(\Big \downarrow \) 3975 |
\(\displaystyle \frac {2 a \int (d \sec (e+f x))^{2 n} (i \tan (e+f x) a+a)^{1-n}dx}{n+1}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {2 a \int (d \sec (e+f x))^{2 n} (i \tan (e+f x) a+a)^{1-n}dx}{n+1}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)}\) |
\(\Big \downarrow \) 3974 |
\(\displaystyle \frac {2 i a^2 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n (n+1)}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)}\) |
Input:
Int[(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(2 - n),x]
Output:
(I*a*(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(1 - n))/(f*(1 + n)) + ((2*I)*a^2*(d*Sec[e + f*x])^(2*n))/(f*n*(1 + n)*(a + I*a*Tan[e + f*x])^n)
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*( x_)])^(n_), x_Symbol] :> Simp[2*b*(d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])^ (n - 1)/(f*m)), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0] && EqQ[Simplify[m/2 + n - 1], 0]
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*( x_)])^(n_), x_Symbol] :> Simp[b*(d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] + Simp[a*((m + 2*n - 2)/(m + n - 1)) Int[(d*Se c[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0] && IGtQ[Simplify[m/2 + n - 1], 0] && !Inte gerQ[n]
\[\int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{2-n}d x\]
Input:
int((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x)
Output:
int((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x)
Time = 0.09 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.51 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=\frac {{\left ({\left (i \, n + i\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (i \, n + 2 i\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i\right )} \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{2 \, n} e^{\left (-i \, e n + {\left (-i \, f n + 2 i \, f\right )} x - 4 i \, f x - {\left (n - 2\right )} \log \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right ) - {\left (n - 2\right )} \log \left (\frac {a}{d}\right ) - 2 i \, e\right )}}{2 \, {\left (f n^{2} + f n\right )}} \] Input:
integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="fric as")
Output:
1/2*((I*n + I)*e^(4*I*f*x + 4*I*e) + (I*n + 2*I)*e^(2*I*f*x + 2*I*e) + I)* (2*d*e^(I*f*x + I*e)/(e^(2*I*f*x + 2*I*e) + 1))^(2*n)*e^(-I*e*n + (-I*f*n + 2*I*f)*x - 4*I*f*x - (n - 2)*log(2*d*e^(I*f*x + I*e)/(e^(2*I*f*x + 2*I*e ) + 1)) - (n - 2)*log(a/d) - 2*I*e)/(f*n^2 + f*n)
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=\int \left (d \sec {\left (e + f x \right )}\right )^{2 n} \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{2 - n}\, dx \] Input:
integrate((d*sec(f*x+e))**(2*n)*(a+I*a*tan(f*x+e))**(2-n),x)
Output:
Integral((d*sec(e + f*x))**(2*n)*(I*a*(tan(e + f*x) - I))**(2 - n), x)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 304 vs. \(2 (84) = 168\).
Time = 0.30 (sec) , antiderivative size = 304, normalized size of antiderivative = 3.30 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=\frac {2^{n + 1} a^{2} d^{2 \, n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - i \cdot 2^{n + 1} a^{2} d^{2 \, n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 2 \, {\left (a^{2} d^{2 \, n} n + a^{2} d^{2 \, n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + 2 \, {\left (-i \, a^{2} d^{2 \, n} n - i \, a^{2} d^{2 \, n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right )}{{\left (-i \, a^{n} n^{2} - i \, a^{n} n + {\left (-i \, a^{n} n^{2} - i \, a^{n} n\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (a^{n} n^{2} + a^{n} n\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} f} \] Input:
integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="maxi ma")
Output:
(2^(n + 1)*a^2*d^(2*n)*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - I*2^(n + 1)*a^2*d^(2*n)*sin(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + 2*(a^2*d^(2*n)*n + a^2*d^(2*n))*2^n*cos(-2*f*x + n*arctan2(si n(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) + 2*(-I*a^2*d^(2*n)*n - I*a^2 *d^(2*n))*2^n*sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e))/((-I*a^n*n^2 - I*a^n*n + (-I*a^n*n^2 - I*a^n*n)*cos(2*f*x + 2*e ) + (a^n*n^2 + a^n*n)*sin(2*f*x + 2*e))*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*f)
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=\int { \left (d \sec \left (f x + e\right )\right )^{2 \, n} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{-n + 2} \,d x } \] Input:
integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="giac ")
Output:
integrate((d*sec(f*x + e))^(2*n)*(I*a*tan(f*x + e) + a)^(-n + 2), x)
Time = 5.23 (sec) , antiderivative size = 260, normalized size of antiderivative = 2.83 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=-{\mathrm {e}}^{-e\,4{}\mathrm {i}-f\,x\,4{}\mathrm {i}}\,{\left (\frac {d}{\frac {{\mathrm {e}}^{-e\,1{}\mathrm {i}-f\,x\,1{}\mathrm {i}}}{2}+\frac {{\mathrm {e}}^{e\,1{}\mathrm {i}+f\,x\,1{}\mathrm {i}}}{2}}\right )}^{2\,n}\,\left (\frac {{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+2\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+1\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}\right ) \] Input:
int((d/cos(e + f*x))^(2*n)*(a + a*tan(e + f*x)*1i)^(2 - n),x)
Output:
-exp(- e*4i - f*x*4i)*(d/(exp(- e*1i - f*x*1i)/2 + exp(e*1i + f*x*1i)/2))^ (2*n)*((a - (a*(exp(e*2i + f*x*2i)*1i - 1i)*1i)/(exp(e*2i + f*x*2i) + 1))^ (2 - n)/(2*f*n*(n*1i + 1i)) + (exp(e*2i + f*x*2i)*(a - (a*(exp(e*2i + f*x* 2i)*1i - 1i)*1i)/(exp(e*2i + f*x*2i) + 1))^(2 - n)*(n + 2))/(2*f*n*(n*1i + 1i)) + (exp(e*4i + f*x*4i)*(a - (a*(exp(e*2i + f*x*2i)*1i - 1i)*1i)/(exp( e*2i + f*x*2i) + 1))^(2 - n)*(n + 1))/(2*f*n*(n*1i + 1i)))
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx=d^{2 n} a^{2} \left (\int \frac {\sec \left (f x +e \right )^{2 n}}{\left (\tan \left (f x +e \right ) a i +a \right )^{n}}d x -\left (\int \frac {\sec \left (f x +e \right )^{2 n} \tan \left (f x +e \right )^{2}}{\left (\tan \left (f x +e \right ) a i +a \right )^{n}}d x \right )+2 \left (\int \frac {\sec \left (f x +e \right )^{2 n} \tan \left (f x +e \right )}{\left (\tan \left (f x +e \right ) a i +a \right )^{n}}d x \right ) i \right ) \] Input:
int((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x)
Output:
d**(2*n)*a**2*(int(sec(e + f*x)**(2*n)/(tan(e + f*x)*a*i + a)**n,x) - int( (sec(e + f*x)**(2*n)*tan(e + f*x)**2)/(tan(e + f*x)*a*i + a)**n,x) + 2*int ((sec(e + f*x)**(2*n)*tan(e + f*x))/(tan(e + f*x)*a*i + a)**n,x)*i)