\(\int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx\) [1181]

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

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

Mathematica [A] (verified)

Time = 0.50 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.79 \[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\frac {(a+i a \tan (e+f x))^m \left (-i (c-i d)^2 (1+m) \operatorname {Hypergeometric2F1}\left (1,m,1+m,\frac {1}{2} (1+i \tan (e+f x))\right )+2 d (-i d m+2 c (1+m)+d m \tan (e+f x))\right )}{2 f m (1+m)} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.50 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.03, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 4026, 3042, 4010, 3042, 3962, 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 (e+f x))^m (c+d \tan (e+f x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2dx\)

\(\Big \downarrow \) 4026

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4010

\(\displaystyle (c-i d)^2 \int (i \tan (e+f x) a+a)^mdx+\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)}\)

\(\Big \downarrow \) 3042

\(\displaystyle (c-i d)^2 \int (i \tan (e+f x) a+a)^mdx+\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)}\)

\(\Big \downarrow \) 3962

\(\displaystyle -\frac {i a (c-i d)^2 \int \frac {(i \tan (e+f x) a+a)^{m-1}}{a-i a \tan (e+f x)}d(i a \tan (e+f x))}{f}+\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)}\)

\(\Big \downarrow \) 78

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

Input:

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

Output:

(2*c*d*(a + I*a*Tan[e + f*x])^m)/(f*m) - ((I/2)*(c - I*d)^2*Hypergeometric 
2F1[1, m, 1 + m, (a + I*a*Tan[e + f*x])/(2*a)]*(a + I*a*Tan[e + f*x])^m)/( 
f*m) - (I*d^2*(a + I*a*Tan[e + f*x])^(1 + m))/(a*f*(1 + m))
 

Defintions of rubi rules used

rule 78
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]
 

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

rule 3962
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[-b/d   S 
ubst[Int[(a + x)^(n - 1)/(a - x), x], x, b*Tan[c + d*x]], x] /; FreeQ[{a, b 
, c, d, n}, x] && EqQ[a^2 + b^2, 0]
 

rule 4010
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Simp 
[(b*c + a*d)/b   Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e 
, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]
 

rule 4026
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( 
m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* 
x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ 
[m, -1] &&  !(EqQ[m, 2] && EqQ[a, 0])
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

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

integrate((a+I*a*tan(f*x+e))**m*(c+d*tan(f*x+e))**2,x)
 

Output:

Integral((I*a*(tan(e + f*x) - I))**m*(c + d*tan(e + f*x))**2, x)
 

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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