Integrand size = 31, antiderivative size = 64 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\frac {2 i a^2 (c-i c \tan (e+f x))^n}{f n}-\frac {i a^2 (c-i c \tan (e+f x))^{1+n}}{c f (1+n)} \] Output:
2*I*a^2*(c-I*c*tan(f*x+e))^n/f/n-I*a^2*(c-I*c*tan(f*x+e))^(1+n)/c/f/(1+n)
Time = 0.60 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.73 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=-\frac {a^2 (c-i c \tan (e+f x))^n (-i (2+n)+n \tan (e+f x))}{f n (1+n)} \] Input:
Integrate[(a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])^n,x]
Output:
-((a^2*(c - I*c*Tan[e + f*x])^n*((-I)*(2 + n) + n*Tan[e + f*x]))/(f*n*(1 + n)))
Time = 0.37 (sec) , antiderivative size = 59, normalized size of antiderivative = 0.92, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3042, 4005, 3042, 3968, 53, 2009}
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 (c-i c \tan (e+f x))^n \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^ndx\) |
\(\Big \downarrow \) 4005 |
\(\displaystyle a^2 c^2 \int \sec ^4(e+f x) (c-i c \tan (e+f x))^{n-2}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle a^2 c^2 \int \sec (e+f x)^4 (c-i c \tan (e+f x))^{n-2}dx\) |
\(\Big \downarrow \) 3968 |
\(\displaystyle \frac {i a^2 \int (c-i c \tan (e+f x))^{n-1} (i \tan (e+f x) c+c)d(-i c \tan (e+f x))}{c f}\) |
\(\Big \downarrow \) 53 |
\(\displaystyle \frac {i a^2 \int \left (2 c (c-i c \tan (e+f x))^{n-1}-(c-i c \tan (e+f x))^n\right )d(-i c \tan (e+f x))}{c f}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {i a^2 \left (\frac {2 c (c-i c \tan (e+f x))^n}{n}-\frac {(c-i c \tan (e+f x))^{n+1}}{n+1}\right )}{c f}\) |
Input:
Int[(a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])^n,x]
Output:
(I*a^2*((2*c*(c - I*c*Tan[e + f*x])^n)/n - (c - I*c*Tan[e + f*x])^(1 + n)/ (1 + n)))/(c*f)
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int [ExpandIntegrand[(a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0] && LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])
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[((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]))
Time = 0.72 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.22
method | result | size |
derivativedivides | \(\frac {i \left (a^{2} n +2 a^{2}\right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f n \left (1+n \right )}-\frac {a^{2} \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (1+n \right )}\) | \(78\) |
default | \(\frac {i \left (a^{2} n +2 a^{2}\right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f n \left (1+n \right )}-\frac {a^{2} \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (1+n \right )}\) | \(78\) |
norman | \(\frac {i \left (a^{2} n +2 a^{2}\right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f n \left (1+n \right )}-\frac {a^{2} \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (1+n \right )}\) | \(78\) |
risch | \(\frac {2 i a^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{-n} 2^{n} c^{n} \left (n \,{\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \pi n}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (i c \right ) \pi n}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{3} \pi n}{2}} {\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \operatorname {csgn}\left (i c \right ) \pi n}{2}} {\mathrm e}^{2 i f x} {\mathrm e}^{2 i e}+{\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \pi n}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (i c \right ) \pi n}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{3} \pi n}{2}} {\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \operatorname {csgn}\left (i c \right ) \pi n}{2}} {\mathrm e}^{2 i f x} {\mathrm e}^{2 i e}+{\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \pi n \left (-\operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )+\operatorname {csgn}\left (i c \right )\right ) \left (\operatorname {csgn}\left (\frac {i c}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )-\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )\right )}{2}}\right )}{\left (1+n \right ) f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) n}\) | \(458\) |
Input:
int((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x,method=_RETURNVERBOSE)
Output:
I/f/n/(1+n)*(a^2*n+2*a^2)*exp(n*ln(c-I*c*tan(f*x+e)))-a^2/f/(1+n)*tan(f*x+ e)*exp(n*ln(c-I*c*tan(f*x+e)))
Time = 0.10 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.22 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=-\frac {2 \, {\left (-i \, a^{2} + {\left (-i \, a^{2} n - i \, a^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac {2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{2} + f n + {\left (f n^{2} + f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \] Input:
integrate((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")
Output:
-2*(-I*a^2 + (-I*a^2*n - I*a^2)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2* I*e) + 1))^n/(f*n^2 + f*n + (f*n^2 + f*n)*e^(2*I*f*x + 2*I*e))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 311 vs. \(2 (49) = 98\).
Time = 0.49 (sec) , antiderivative size = 311, normalized size of antiderivative = 4.86 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\begin {cases} x \left (i a \tan {\left (e \right )} + a\right )^{2} \left (- i c \tan {\left (e \right )} + c\right )^{n} & \text {for}\: f = 0 \\- \frac {2 a^{2} f x \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {2 i a^{2} f x}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {i a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {4 a^{2}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} & \text {for}\: n = -1 \\2 a^{2} x + \frac {i a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - \frac {a^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: n = 0 \\- \frac {a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{2} + f n} + \frac {i a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{2} + f n} + \frac {2 i a^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{2} + f n} & \text {otherwise} \end {cases} \] Input:
integrate((a+I*a*tan(f*x+e))**2*(c-I*c*tan(f*x+e))**n,x)
Output:
Piecewise((x*(I*a*tan(e) + a)**2*(-I*c*tan(e) + c)**n, Eq(f, 0)), (-2*a**2 *f*x*tan(e + f*x)/(2*c*f*tan(e + f*x) + 2*I*c*f) - 2*I*a**2*f*x/(2*c*f*tan (e + f*x) + 2*I*c*f) - I*a**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*c*f *tan(e + f*x) + 2*I*c*f) + a**2*log(tan(e + f*x)**2 + 1)/(2*c*f*tan(e + f* x) + 2*I*c*f) + 4*a**2/(2*c*f*tan(e + f*x) + 2*I*c*f), Eq(n, -1)), (2*a**2 *x + I*a**2*log(tan(e + f*x)**2 + 1)/f - a**2*tan(e + f*x)/f, Eq(n, 0)), ( -a**2*n*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)/(f*n**2 + f*n) + I*a**2*n* (-I*c*tan(e + f*x) + c)**n/(f*n**2 + f*n) + 2*I*a**2*(-I*c*tan(e + f*x) + c)**n/(f*n**2 + f*n), True))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 272 vs. \(2 (56) = 112\).
Time = 0.20 (sec) , antiderivative size = 272, normalized size of antiderivative = 4.25 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\frac {2^{n + 1} a^{2} c^{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} c^{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} c^{n} n + a^{2} c^{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} c^{n} n - i \, a^{2} c^{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 \, n^{2} + {\left (-i \, n^{2} - i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (n^{2} + n\right )} \sin \left (2 \, f x + 2 \, e\right ) - i \, n\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((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")
Output:
(2^(n + 1)*a^2*c^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - I*2^(n + 1)*a^2*c^n*sin(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1 )) + 2*(a^2*c^n*n + a^2*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) + 2*(-I*a^2*c^n*n - I*a^2*c^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*n^2 + (- I*n^2 - I*n)*cos(2*f*x + 2*e) + (n^2 + n)*sin(2*f*x + 2*e) - I*n)*(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 (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n} \,d x } \] Input:
integrate((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")
Output:
integrate((I*a*tan(f*x + e) + a)^2*(-I*c*tan(f*x + e) + c)^n, x)
Time = 0.40 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.75 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\frac {a^2\,{\left (\frac {c\,\left (\cos \left (2\,e+2\,f\,x\right )+1-\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,e+2\,f\,x\right )+1}\right )}^n\,\left (n\,1{}\mathrm {i}+\cos \left (2\,e+2\,f\,x\right )\,2{}\mathrm {i}+n\,\cos \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}-n\,\sin \left (2\,e+2\,f\,x\right )+2{}\mathrm {i}\right )}{f\,n\,\left (\cos \left (2\,e+2\,f\,x\right )+1\right )\,\left (n+1\right )} \] Input:
int((a + a*tan(e + f*x)*1i)^2*(c - c*tan(e + f*x)*1i)^n,x)
Output:
(a^2*((c*(cos(2*e + 2*f*x) - sin(2*e + 2*f*x)*1i + 1))/(cos(2*e + 2*f*x) + 1))^n*(n*1i + cos(2*e + 2*f*x)*2i + n*cos(2*e + 2*f*x)*1i - n*sin(2*e + 2 *f*x) + 2i))/(f*n*(cos(2*e + 2*f*x) + 1)*(n + 1))
Time = 0.21 (sec) , antiderivative size = 45, normalized size of antiderivative = 0.70 \[ \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx=\frac {\left (-\tan \left (f x +e \right ) c i +c \right )^{n} a^{2} \left (-\tan \left (f x +e \right ) n +i n +2 i \right )}{f n \left (n +1\right )} \] Input:
int((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x)
Output:
(( - tan(e + f*x)*c*i + c)**n*a**2*( - tan(e + f*x)*n + i*n + 2*i))/(f*n*( n + 1))