\(\int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx\) [336]

Optimal result
Mathematica [B] (verified)
Rubi [A] (warning: unable to verify)
Maple [B] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-1)]
Maxima [F]
Giac [F(-2)]
Mupad [B] (verification not implemented)
Reduce [F]

Optimal result

Integrand size = 33, antiderivative size = 196 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=-\frac {a^{3/2} (5 A b+2 a B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{d}+\frac {(a-i b)^{5/2} (i A+B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a-i b}}\right )}{d}-\frac {(a+i b)^{5/2} (i A-B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a+i b}}\right )}{d}+\frac {b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d} \] Output:

-a^(3/2)*(5*A*b+2*B*a)*arctanh((a+b*tan(d*x+c))^(1/2)/a^(1/2))/d+(a-I*b)^( 
5/2)*(I*A+B)*arctanh((a+b*tan(d*x+c))^(1/2)/(a-I*b)^(1/2))/d-(a+I*b)^(5/2) 
*(I*A-B)*arctanh((a+b*tan(d*x+c))^(1/2)/(a+I*b)^(1/2))/d+b*(A*a+2*B*b)*(a+ 
b*tan(d*x+c))^(1/2)/d-a*A*cot(d*x+c)*(a+b*tan(d*x+c))^(3/2)/d
 

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(400\) vs. \(2(196)=392\).

Time = 0.73 (sec) , antiderivative size = 400, normalized size of antiderivative = 2.04 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\frac {2 b B \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}+2 \left (-\frac {b (A b+4 a B) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}-2 \left (-\frac {-\frac {a^{5/2} (5 A b+2 a B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{4 d}+\frac {i \sqrt {a-i b} \left (\frac {1}{4} i a \left (3 a^2 A b-A b^3+a^3 B-3 a b^2 B\right )-\frac {1}{4} a \left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right )\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a-i b}}\right )}{(-a+i b) d}-\frac {i \sqrt {a+i b} \left (-\frac {1}{4} i a \left (3 a^2 A b-A b^3+a^3 B-3 a b^2 B\right )-\frac {1}{4} a \left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right )\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a+i b}}\right )}{(-a-i b) d}}{a}+\frac {\left (a^2 A-2 A b^2-6 a b B\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{4 d}\right )\right ) \] Input:

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

Output:

(2*b*B*Cot[c + d*x]*(a + b*Tan[c + d*x])^(3/2))/d + 2*(-((b*(A*b + 4*a*B)* 
Cot[c + d*x]*Sqrt[a + b*Tan[c + d*x]])/d) - 2*(-((-1/4*(a^(5/2)*(5*A*b + 2 
*a*B)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/d + (I*Sqrt[a - I*b]*((I/ 
4)*a*(3*a^2*A*b - A*b^3 + a^3*B - 3*a*b^2*B) - (a*(a^3*A - 3*a*A*b^2 - 3*a 
^2*b*B + b^3*B))/4)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a - I*b]])/((-a 
+ I*b)*d) - (I*Sqrt[a + I*b]*((-1/4*I)*a*(3*a^2*A*b - A*b^3 + a^3*B - 3*a* 
b^2*B) - (a*(a^3*A - 3*a*A*b^2 - 3*a^2*b*B + b^3*B))/4)*ArcTanh[Sqrt[a + b 
*Tan[c + d*x]]/Sqrt[a + I*b]])/((-a - I*b)*d))/a) + ((a^2*A - 2*A*b^2 - 6* 
a*b*B)*Cot[c + d*x]*Sqrt[a + b*Tan[c + d*x]])/(4*d)))
 

Rubi [A] (warning: unable to verify)

Time = 1.78 (sec) , antiderivative size = 186, normalized size of antiderivative = 0.95, number of steps used = 20, number of rules used = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.576, Rules used = {3042, 4088, 27, 3042, 4130, 27, 3042, 4136, 27, 3042, 4022, 3042, 4020, 25, 73, 221, 4117, 73, 221}

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+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4088

\(\displaystyle \int \frac {1}{2} \cot (c+d x) \sqrt {a+b \tan (c+d x)} \left (b (a A+2 b B) \tan ^2(c+d x)-2 \left (A a^2-2 b B a-A b^2\right ) \tan (c+d x)+a (5 A b+2 a B)\right )dx-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{2} \int \cot (c+d x) \sqrt {a+b \tan (c+d x)} \left (b (a A+2 b B) \tan ^2(c+d x)-2 \left (A a^2-2 b B a-A b^2\right ) \tan (c+d x)+a (5 A b+2 a B)\right )dx-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \int \frac {\sqrt {a+b \tan (c+d x)} \left (b (a A+2 b B) \tan (c+d x)^2-2 \left (A a^2-2 b B a-A b^2\right ) \tan (c+d x)+a (5 A b+2 a B)\right )}{\tan (c+d x)}dx-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 4130

\(\displaystyle \frac {1}{2} \left (2 \int \frac {\cot (c+d x) \left ((5 A b+2 a B) a^2-b \left (A a^2-6 b B a-2 A b^2\right ) \tan ^2(c+d x)-2 \left (A a^3-3 b B a^2-3 A b^2 a+b^3 B\right ) \tan (c+d x)\right )}{2 \sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{2} \left (\int \frac {\cot (c+d x) \left ((5 A b+2 a B) a^2-b \left (A a^2-6 b B a-2 A b^2\right ) \tan ^2(c+d x)-2 \left (A a^3-3 b B a^2-3 A b^2 a+b^3 B\right ) \tan (c+d x)\right )}{\sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \left (\int \frac {(5 A b+2 a B) a^2-b \left (A a^2-6 b B a-2 A b^2\right ) \tan (c+d x)^2-2 \left (A a^3-3 b B a^2-3 A b^2 a+b^3 B\right ) \tan (c+d x)}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 4136

\(\displaystyle \frac {1}{2} \left (a^2 (2 a B+5 A b) \int \frac {\cot (c+d x) \left (\tan ^2(c+d x)+1\right )}{\sqrt {a+b \tan (c+d x)}}dx+\int -\frac {2 \left (A a^3-3 b B a^2-3 A b^2 a+b^3 B+\left (B a^3+3 A b a^2-3 b^2 B a-A b^3\right ) \tan (c+d x)\right )}{\sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{2} \left (a^2 (2 a B+5 A b) \int \frac {\cot (c+d x) \left (\tan ^2(c+d x)+1\right )}{\sqrt {a+b \tan (c+d x)}}dx-2 \int \frac {A a^3-3 b B a^2-3 A b^2 a+b^3 B+\left (B a^3+3 A b a^2-3 b^2 B a-A b^3\right ) \tan (c+d x)}{\sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \left (a^2 (2 a B+5 A b) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-2 \int \frac {A a^3-3 b B a^2-3 A b^2 a+b^3 B+\left (B a^3+3 A b a^2-3 b^2 B a-A b^3\right ) \tan (c+d x)}{\sqrt {a+b \tan (c+d x)}}dx+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}\)

\(\Big \downarrow \) 4022

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4020

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 73

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

\(\Big \downarrow \) 221

\(\displaystyle -\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}+\frac {1}{2} \left (a^2 (2 a B+5 A b) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-2 \left (\frac {(a-i b)^{5/2} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {(a+i b)^{5/2} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )\)

\(\Big \downarrow \) 4117

\(\displaystyle -\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}+\frac {1}{2} \left (\frac {a^2 (2 a B+5 A b) \int \frac {\cot (c+d x)}{\sqrt {a+b \tan (c+d x)}}d\tan (c+d x)}{d}-2 \left (\frac {(a-i b)^{5/2} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {(a+i b)^{5/2} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )\)

\(\Big \downarrow \) 73

\(\displaystyle -\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}+\frac {1}{2} \left (\frac {2 a^2 (2 a B+5 A b) \int \frac {1}{\frac {a+b \tan (c+d x)}{b}-\frac {a}{b}}d\sqrt {a+b \tan (c+d x)}}{b d}-2 \left (\frac {(a-i b)^{5/2} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {(a+i b)^{5/2} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )\)

\(\Big \downarrow \) 221

\(\displaystyle -\frac {a A \cot (c+d x) (a+b \tan (c+d x))^{3/2}}{d}+\frac {1}{2} \left (-\frac {2 a^{3/2} (2 a B+5 A b) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{d}-2 \left (\frac {(a-i b)^{5/2} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {(a+i b)^{5/2} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )+\frac {2 b (a A+2 b B) \sqrt {a+b \tan (c+d x)}}{d}\right )\)

Input:

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

Output:

-((a*A*Cot[c + d*x]*(a + b*Tan[c + d*x])^(3/2))/d) + (-2*(((a - I*b)^(5/2) 
*(A - I*B)*ArcTan[Tan[c + d*x]/Sqrt[a - I*b]])/d + ((a + I*b)^(5/2)*(A + I 
*B)*ArcTan[Tan[c + d*x]/Sqrt[a + I*b]])/d) - (2*a^(3/2)*(5*A*b + 2*a*B)*Ar 
cTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/d + (2*b*(a*A + 2*b*B)*Sqrt[a + b 
*Tan[c + d*x]])/d)/2
 

Defintions of rubi rules used

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

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 73
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[ 
{p = Denominator[m]}, Simp[p/b   Subst[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + 
 d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] && Lt 
Q[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntL 
inearQ[a, b, c, d, m, n, x]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

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

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

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

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

rule 4117
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> 
 Simp[A/f   Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x] /; 
FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]
 

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

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

Leaf count of result is larger than twice the leaf count of optimal. \(2389\) vs. \(2(168)=336\).

Time = 0.16 (sec) , antiderivative size = 2390, normalized size of antiderivative = 12.19

method result size
derivativedivides \(\text {Expression too large to display}\) \(2390\)
default \(\text {Expression too large to display}\) \(2390\)

Input:

int(cot(d*x+c)^2*(a+b*tan(d*x+c))^(5/2)*(A+B*tan(d*x+c)),x,method=_RETURNV 
ERBOSE)
 

Output:

1/4/d/b*ln(b*tan(d*x+c)+a+(a+b*tan(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^( 
1/2)+(a^2+b^2)^(1/2))*A*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*(a^2+b^2)^(1/2)*a^2+ 
2/d*b/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan((2*(a+b*tan(d*x+c))^(1/2)+(2*(a 
^2+b^2)^(1/2)+2*a)^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*A*(a^2+b^2)^(1/2) 
*a-1/4/d/b*ln((a+b*tan(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)-b*tan(d 
*x+c)-a-(a^2+b^2)^(1/2))*A*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*(a^2+b^2)^(1/2)*a 
^2-2/d*b/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan(((2*(a^2+b^2)^(1/2)+2*a)^(1/ 
2)-2*(a+b*tan(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*A*(a^2+b^2)^(1 
/2)*a+2/d*b^2*(a+b*tan(d*x+c))^(1/2)*B-2/d*a^(5/2)*arctanh((a+b*tan(d*x+c) 
)^(1/2)/a^(1/2))*B-1/d*a^2*A*(a+b*tan(d*x+c))^(1/2)/tan(d*x+c)-5/d*b*A*a^( 
3/2)*arctanh((a+b*tan(d*x+c))^(1/2)/a^(1/2))-1/d/(2*(a^2+b^2)^(1/2)-2*a)^( 
1/2)*arctan(((2*(a^2+b^2)^(1/2)+2*a)^(1/2)-2*(a+b*tan(d*x+c))^(1/2))/(2*(a 
^2+b^2)^(1/2)-2*a)^(1/2))*B*(a^2+b^2)^(1/2)*a^2-3/d*b/(2*(a^2+b^2)^(1/2)-2 
*a)^(1/2)*arctan((2*(a+b*tan(d*x+c))^(1/2)+(2*(a^2+b^2)^(1/2)+2*a)^(1/2))/ 
(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*A*a^2+3/d*b^2/(2*(a^2+b^2)^(1/2)-2*a)^(1/2) 
*arctan((2*(a+b*tan(d*x+c))^(1/2)+(2*(a^2+b^2)^(1/2)+2*a)^(1/2))/(2*(a^2+b 
^2)^(1/2)-2*a)^(1/2))*B*a-1/d*b^2/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan((2* 
(a+b*tan(d*x+c))^(1/2)+(2*(a^2+b^2)^(1/2)+2*a)^(1/2))/(2*(a^2+b^2)^(1/2)-2 
*a)^(1/2))*B*(a^2+b^2)^(1/2)+1/4/d*b*ln((a+b*tan(d*x+c))^(1/2)*(2*(a^2+b^2 
)^(1/2)+2*a)^(1/2)-b*tan(d*x+c)-a-(a^2+b^2)^(1/2))*A*(2*(a^2+b^2)^(1/2)...
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4897 vs. \(2 (162) = 324\).

Time = 12.98 (sec) , antiderivative size = 9812, normalized size of antiderivative = 50.06 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\text {Too large to display} \] Input:

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^(5/2)*(A+B*tan(d*x+c)),x, algorith 
m="fricas")
 

Output:

Too large to include
 

Sympy [F(-1)]

Timed out. \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\text {Timed out} \] Input:

integrate(cot(d*x+c)**2*(a+b*tan(d*x+c))**(5/2)*(A+B*tan(d*x+c)),x)
 

Output:

Timed out
 

Maxima [F]

\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{\frac {5}{2}} \cot \left (d x + c\right )^{2} \,d x } \] Input:

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^(5/2)*(A+B*tan(d*x+c)),x, algorith 
m="maxima")
 

Output:

integrate((B*tan(d*x + c) + A)*(b*tan(d*x + c) + a)^(5/2)*cot(d*x + c)^2, 
x)
 

Giac [F(-2)]

Exception generated. \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\text {Exception raised: TypeError} \] Input:

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^(5/2)*(A+B*tan(d*x+c)),x, algorith 
m="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Unable to divide, perhaps due to ro 
unding error%%%{%%%{1,[0,17,7]%%%}+%%%{8,[0,15,7]%%%}+%%%{28,[0,13,7]%%%}+ 
%%%{56,[0
 

Mupad [B] (verification not implemented)

Time = 7.22 (sec) , antiderivative size = 31186, normalized size of antiderivative = 159.11 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\text {Too large to display} \] Input:

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

Output:

(2*B*b^2*(a + b*tan(c + d*x))^(1/2))/d - atan(((((8*(176*A^3*a^5*b^13*d^2 
- 400*A^3*a^3*b^15*d^2 + 488*A^3*a^7*b^11*d^2 - 92*A^3*a^9*b^9*d^2 + 12*B^ 
3*a^2*b^16*d^2 + 192*B^3*a^4*b^14*d^2 - 120*B^3*a^6*b^12*d^2 - 288*B^3*a^8 
*b^10*d^2 + 12*B^3*a^10*b^8*d^2 + 4*A^3*a*b^17*d^2 + 4*A*B^2*a*b^17*d^2 + 
464*A*B^2*a^3*b^15*d^2 - 920*A*B^2*a^5*b^13*d^2 - 1104*A*B^2*a^7*b^11*d^2 
+ 276*A*B^2*a^9*b^9*d^2 + 172*A^2*B*a^2*b^16*d^2 - 1468*A^2*B*a^4*b^14*d^2 
 - 776*A^2*B*a^6*b^12*d^2 + 828*A^2*B*a^8*b^10*d^2 - 36*A^2*B*a^10*b^8*d^2 
))/d^5 - (((8*(16*B*a*b^12*d^4 + 128*A*a^2*b^11*d^4 + 128*A*a^4*b^9*d^4 + 
64*B*a^3*b^10*d^4 + 48*B*a^5*b^8*d^4))/d^5 - (16*(32*b^10*d^4 + 48*a^2*b^8 
*d^4)*(a + b*tan(c + d*x))^(1/2)*((((8*B^2*a^5*d^2 - 8*A^2*a^5*d^2 + 80*A^ 
2*a^3*b^2*d^2 - 80*B^2*a^3*b^2*d^2 + 16*A*B*b^5*d^2 - 40*A^2*a*b^4*d^2 + 4 
0*B^2*a*b^4*d^2 - 160*A*B*a^2*b^3*d^2 + 80*A*B*a^4*b*d^2)^2/64 - d^4*(A^4* 
a^10 + A^4*b^10 + B^4*a^10 + B^4*b^10 + 2*A^2*B^2*a^10 + 2*A^2*B^2*b^10 + 
5*A^4*a^2*b^8 + 10*A^4*a^4*b^6 + 10*A^4*a^6*b^4 + 5*A^4*a^8*b^2 + 5*B^4*a^ 
2*b^8 + 10*B^4*a^4*b^6 + 10*B^4*a^6*b^4 + 5*B^4*a^8*b^2 + 10*A^2*B^2*a^2*b 
^8 + 20*A^2*B^2*a^4*b^6 + 20*A^2*B^2*a^6*b^4 + 10*A^2*B^2*a^8*b^2))^(1/2) 
- A^2*a^5*d^2 + B^2*a^5*d^2 + 10*A^2*a^3*b^2*d^2 - 10*B^2*a^3*b^2*d^2 + 2* 
A*B*b^5*d^2 - 5*A^2*a*b^4*d^2 + 5*B^2*a*b^4*d^2 - 20*A*B*a^2*b^3*d^2 + 10* 
A*B*a^4*b*d^2)/(4*d^4))^(1/2))/d^4)*((((8*B^2*a^5*d^2 - 8*A^2*a^5*d^2 + 80 
*A^2*a^3*b^2*d^2 - 80*B^2*a^3*b^2*d^2 + 16*A*B*b^5*d^2 - 40*A^2*a*b^4*d...
 

Reduce [F]

\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^{5/2} (A+B \tan (c+d x)) \, dx=\int \cot \left (d x +c \right )^{2} \left (a +\tan \left (d x +c \right ) b \right )^{\frac {5}{2}} \left (A +B \tan \left (d x +c \right )\right )d x \] Input:

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

Output:

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