\(\int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\) [13]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [A] (verification not implemented)
Maxima [A] (verification not implemented)
Giac [A] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 79 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-2 a^2 (A-i B) x+\frac {a^2 B \log (\cos (c+d x))}{d}+\frac {a^2 (2 i A+B) \log (\sin (c+d x))}{d}-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d} \] Output:

-2*a^2*(A-I*B)*x+a^2*B*ln(cos(d*x+c))/d+a^2*(2*I*A+B)*ln(sin(d*x+c))/d-A*c 
ot(d*x+c)*(a^2+I*a^2*tan(d*x+c))/d
 

Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.68 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^2 (-A \cot (c+d x)+(2 i A+B) \log (\tan (c+d x))-2 i (A-i B) \log (i+\tan (c+d x)))}{d} \] Input:

Integrate[Cot[c + d*x]^2*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
 

Output:

(a^2*(-(A*Cot[c + d*x]) + ((2*I)*A + B)*Log[Tan[c + d*x]] - (2*I)*(A - I*B 
)*Log[I + Tan[c + d*x]]))/d
 

Rubi [A] (verified)

Time = 0.64 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.03, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.294, Rules used = {3042, 4076, 3042, 4072, 3042, 3956, 4014, 3042, 25, 3956}

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 \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+i a \tan (c+d x))^2 (A+B \tan (c+d x))}{\tan (c+d x)^2}dx\)

\(\Big \downarrow \) 4076

\(\displaystyle \int \cot (c+d x) (i \tan (c+d x) a+a) (a (2 i A+B)+i a B \tan (c+d x))dx-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(i \tan (c+d x) a+a) (a (2 i A+B)+i a B \tan (c+d x))}{\tan (c+d x)}dx-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}\)

\(\Big \downarrow \) 4072

\(\displaystyle \int \cot (c+d x) \left (a^2 (2 i A+B)-2 a^2 (A-i B) \tan (c+d x)\right )dx+a^2 (-B) \int \tan (c+d x)dx-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a^2 (2 i A+B)-2 a^2 (A-i B) \tan (c+d x)}{\tan (c+d x)}dx+a^2 (-B) \int \tan (c+d x)dx-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \int \frac {a^2 (2 i A+B)-2 a^2 (A-i B) \tan (c+d x)}{\tan (c+d x)}dx-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\frac {a^2 B \log (\cos (c+d x))}{d}\)

\(\Big \downarrow \) 4014

\(\displaystyle a^2 (B+2 i A) \int \cot (c+d x)dx-2 a^2 x (A-i B)-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\frac {a^2 B \log (\cos (c+d x))}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle a^2 (B+2 i A) \int -\tan \left (c+d x+\frac {\pi }{2}\right )dx-2 a^2 x (A-i B)-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\frac {a^2 B \log (\cos (c+d x))}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle -a^2 (B+2 i A) \int \tan \left (\frac {1}{2} (2 c+\pi )+d x\right )dx-2 a^2 x (A-i B)-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\frac {a^2 B \log (\cos (c+d x))}{d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {a^2 (B+2 i A) \log (-\sin (c+d x))}{d}-2 a^2 x (A-i B)-\frac {A \cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\frac {a^2 B \log (\cos (c+d x))}{d}\)

Input:

Int[Cot[c + d*x]^2*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
 

Output:

-2*a^2*(A - I*B)*x + (a^2*B*Log[Cos[c + d*x]])/d + (a^2*((2*I)*A + B)*Log[ 
-Sin[c + d*x]])/d - (A*Cot[c + d*x]*(a^2 + I*a^2*Tan[c + d*x]))/d
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

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

rule 4072
Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_ 
.)*(x_)]))/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B*(d/ 
b)   Int[Tan[e + f*x], x], x] + Simp[1/b   Int[Simp[A*b*c + (A*b*d + B*(b*c 
 - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d 
, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 

rule 4076
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[(-a^2)*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x])^(n 
+ 1)/(d*f*(b*c + a*d)*(n + 1))), x] - Simp[a/(d*(b*c + a*d)*(n + 1))   Int[ 
(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n 
 - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m - 1) + b 
*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] 
 && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]
 
Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.96

method result size
parallelrisch \(-\frac {a^{2} \left (-i A \left (-\ln \left (\sec \left (d x +c \right )^{2}\right )+2 \ln \left (\tan \left (d x +c \right )\right )\right )-B \left (\ln \left (\tan \left (d x +c \right )\right )-\ln \left (\sec \left (d x +c \right )^{2}\right )\right )-2 i B d x +2 A d x +A \cot \left (d x +c \right )\right )}{d}\) \(76\)
derivativedivides \(\frac {-A \,a^{2} \left (d x +c \right )+B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )+2 i A \,a^{2} \ln \left (\sin \left (d x +c \right )\right )+2 i B \,a^{2} \left (d x +c \right )+A \,a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+B \,a^{2} \ln \left (\sin \left (d x +c \right )\right )}{d}\) \(88\)
default \(\frac {-A \,a^{2} \left (d x +c \right )+B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )+2 i A \,a^{2} \ln \left (\sin \left (d x +c \right )\right )+2 i B \,a^{2} \left (d x +c \right )+A \,a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+B \,a^{2} \ln \left (\sin \left (d x +c \right )\right )}{d}\) \(88\)
norman \(\frac {\left (2 i B \,a^{2}-2 A \,a^{2}\right ) x \tan \left (d x +c \right )-\frac {A \,a^{2}}{d}}{\tan \left (d x +c \right )}+\frac {\left (2 i A \,a^{2}+B \,a^{2}\right ) \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {\left (i A \,a^{2}+B \,a^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d}\) \(96\)
risch \(-\frac {4 i a^{2} B c}{d}+\frac {4 a^{2} A c}{d}-\frac {2 i A \,a^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{d}+\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) A}{d}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}\) \(108\)

Input:

int(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x,method=_RETURNVER 
BOSE)
 

Output:

-1/d*a^2*(-I*A*(-ln(sec(d*x+c)^2)+2*ln(tan(d*x+c)))-B*(ln(tan(d*x+c))-ln(s 
ec(d*x+c)^2))-2*I*B*d*x+2*A*d*x+A*cot(d*x+c))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.29 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {-2 i \, A a^{2} + {\left (B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - B a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + {\left ({\left (2 i \, A + B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-2 i \, A - B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d e^{\left (2 i \, d x + 2 i \, c\right )} - d} \] Input:

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm= 
"fricas")
 

Output:

(-2*I*A*a^2 + (B*a^2*e^(2*I*d*x + 2*I*c) - B*a^2)*log(e^(2*I*d*x + 2*I*c) 
+ 1) + ((2*I*A + B)*a^2*e^(2*I*d*x + 2*I*c) + (-2*I*A - B)*a^2)*log(e^(2*I 
*d*x + 2*I*c) - 1))/(d*e^(2*I*d*x + 2*I*c) - d)
 

Sympy [A] (verification not implemented)

Time = 1.44 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.38 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=- \frac {2 i A a^{2}}{d e^{2 i c} e^{2 i d x} - d} + \frac {B a^{2} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {i a^{2} \cdot \left (2 A - i B\right ) \log {\left (e^{2 i d x} + \frac {\left (A a^{2} - i B a^{2} - a^{2} \cdot \left (2 A - i B\right )\right ) e^{- 2 i c}}{A a^{2}} \right )}}{d} \] Input:

integrate(cot(d*x+c)**2*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)
 

Output:

-2*I*A*a**2/(d*exp(2*I*c)*exp(2*I*d*x) - d) + B*a**2*log(exp(2*I*d*x) + ex 
p(-2*I*c))/d + I*a**2*(2*A - I*B)*log(exp(2*I*d*x) + (A*a**2 - I*B*a**2 - 
a**2*(2*A - I*B))*exp(-2*I*c)/(A*a**2))/d
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.94 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{2} - {\left (-i \, A - B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - {\left (2 i \, A + B\right )} a^{2} \log \left (\tan \left (d x + c\right )\right ) + \frac {A a^{2}}{\tan \left (d x + c\right )}}{d} \] Input:

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm= 
"maxima")
                                                                                    
                                                                                    
 

Output:

-(2*(d*x + c)*(A - I*B)*a^2 - (-I*A - B)*a^2*log(tan(d*x + c)^2 + 1) - (2* 
I*A + B)*a^2*log(tan(d*x + c)) + A*a^2/tan(d*x + c))/d
 

Giac [A] (verification not implemented)

Time = 0.46 (sec) , antiderivative size = 70, normalized size of antiderivative = 0.89 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (i \, A a^{2} + B a^{2}\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{d} - \frac {{\left (-2 i \, A a^{2} - B a^{2}\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{d} - \frac {A a^{2}}{d \tan \left (d x + c\right )} \] Input:

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm= 
"giac")
 

Output:

-2*(I*A*a^2 + B*a^2)*log(tan(d*x + c) + I)/d - (-2*I*A*a^2 - B*a^2)*log(ab 
s(tan(d*x + c)))/d - A*a^2/(d*tan(d*x + c))
 

Mupad [B] (verification not implemented)

Time = 3.80 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.10 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {B\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {2\,B\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{d}-\frac {A\,a^2\,\mathrm {cot}\left (c+d\,x\right )}{d}+\frac {A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,2{}\mathrm {i}}{d}-\frac {A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{d} \] Input:

int(cot(c + d*x)^2*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^2,x)
 

Output:

(A*a^2*log(tan(c + d*x))*2i)/d + (B*a^2*log(tan(c + d*x)))/d - (A*a^2*log( 
tan(c + d*x) + 1i)*2i)/d - (2*B*a^2*log(tan(c + d*x) + 1i))/d - (A*a^2*cot 
(c + d*x))/d
 

Reduce [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 173, normalized size of antiderivative = 2.19 \[ \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^{2} \left (-\cos \left (d x +c \right ) a -2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right ) a i -2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right ) b +\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right ) b +\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right ) b +2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right ) a i +\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right ) b -2 \sin \left (d x +c \right ) a d x +2 \sin \left (d x +c \right ) b d i x \right )}{\sin \left (d x +c \right ) d} \] Input:

int(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)
 

Output:

(a**2*( - cos(c + d*x)*a - 2*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)*a*i 
 - 2*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)*b + log(tan((c + d*x)/2) - 
1)*sin(c + d*x)*b + log(tan((c + d*x)/2) + 1)*sin(c + d*x)*b + 2*log(tan(( 
c + d*x)/2))*sin(c + d*x)*a*i + log(tan((c + d*x)/2))*sin(c + d*x)*b - 2*s 
in(c + d*x)*a*d*x + 2*sin(c + d*x)*b*d*i*x))/(sin(c + d*x)*d)