\(\int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\) [313]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [C] (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 = 112 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {b B x}{a^2+b^2}+\frac {b B \cot (c+d x)}{a^2 d}-\frac {B \cot ^2(c+d x)}{2 a d}-\frac {\left (a^2-b^2\right ) B \log (\sin (c+d x))}{a^3 d}-\frac {b^4 B \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 \left (a^2+b^2\right ) d} \] Output:

b*B*x/(a^2+b^2)+b*B*cot(d*x+c)/a^2/d-1/2*B*cot(d*x+c)^2/a/d-(a^2-b^2)*B*ln 
(sin(d*x+c))/a^3/d-b^4*B*ln(a*cos(d*x+c)+b*sin(d*x+c))/a^3/(a^2+b^2)/d
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.44 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.96 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {B \left (-\frac {2 b \cot (c+d x)}{a^2}+\frac {\cot ^2(c+d x)}{a}-\frac {\log (i-\cot (c+d x))}{a-i b}-\frac {\log (i+\cot (c+d x))}{a+i b}+\frac {2 b^4 \log (b+a \cot (c+d x))}{a^3 \left (a^2+b^2\right )}\right )}{2 d} \] Input:

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

Output:

-1/2*(B*((-2*b*Cot[c + d*x])/a^2 + Cot[c + d*x]^2/a - Log[I - Cot[c + d*x] 
]/(a - I*b) - Log[I + Cot[c + d*x]]/(a + I*b) + (2*b^4*Log[b + a*Cot[c + d 
*x]])/(a^3*(a^2 + b^2))))/d
 

Rubi [A] (verified)

Time = 0.84 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.12, number of steps used = 13, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.382, Rules used = {2011, 3042, 4052, 27, 3042, 4132, 25, 3042, 4135, 3042, 25, 3956, 4013}

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 \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\)

\(\Big \downarrow \) 2011

\(\displaystyle B \int \frac {\cot ^3(c+d x)}{a+b \tan (c+d x)}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle B \int \frac {1}{\tan (c+d x)^3 (a+b \tan (c+d x))}dx\)

\(\Big \downarrow \) 4052

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4132

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4135

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3956

\(\displaystyle B \left (-\frac {\frac {\frac {b^4 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a \left (a^2+b^2\right )}+\frac {\left (a^2-b^2\right ) \log (-\sin (c+d x))}{a d}-\frac {a^2 b x}{a^2+b^2}}{a}-\frac {b \cot (c+d x)}{a d}}{a}-\frac {\cot ^2(c+d x)}{2 a d}\right )\)

\(\Big \downarrow \) 4013

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

Input:

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

Output:

B*(-1/2*Cot[c + d*x]^2/(a*d) - (-((b*Cot[c + d*x])/(a*d)) + (-((a^2*b*x)/( 
a^2 + b^2)) + ((a^2 - b^2)*Log[-Sin[c + d*x]])/(a*d) + (b^4*Log[a*Cos[c + 
d*x] + b*Sin[c + d*x]])/(a*(a^2 + b^2)*d))/a)/a)
 

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 2011
Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> 
 Simp[(b/d)^m   Int[u*(c + d*v)^(m + n), x], x] /; FreeQ[{a, b, c, d, n}, x 
] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c + d*x 
, a + b*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 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[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] && EqQ[a*c + b*d, 0]
 

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

rule 4132
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[(A*b^2 - a*(b*B - a*C))*(a + b*Tan[e + 
 f*x])^(m + 1)*((c + d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(b*c - a*d)*(a^2 + 
b^2))), x] + Simp[1/((m + 1)*(b*c - a*d)*(a^2 + b^2))   Int[(a + b*Tan[e + 
f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[A*(a*(b*c - a*d)*(m + 1) - b^2*d* 
(m + n + 2)) + (b*B - a*C)*(b*c*(m + 1) + a*d*(n + 1)) - (m + 1)*(b*c - a*d 
)*(A*b - a*B - b*C)*Tan[e + f*x] - d*(A*b^2 - a*(b*B - a*C))*(m + n + 2)*Ta 
n[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] && LtQ[m, -1] && 
!(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
 

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

Time = 0.21 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.03

method result size
derivativedivides \(\frac {B \left (\frac {\frac {a \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {1}{2 a \tan \left (d x +c \right )^{2}}+\frac {\left (-a^{2}+b^{2}\right ) \ln \left (\tan \left (d x +c \right )\right )}{a^{3}}+\frac {b}{a^{2} \tan \left (d x +c \right )}-\frac {b^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) a^{3}}\right )}{d}\) \(115\)
default \(\frac {B \left (\frac {\frac {a \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {1}{2 a \tan \left (d x +c \right )^{2}}+\frac {\left (-a^{2}+b^{2}\right ) \ln \left (\tan \left (d x +c \right )\right )}{a^{3}}+\frac {b}{a^{2} \tan \left (d x +c \right )}-\frac {b^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) a^{3}}\right )}{d}\) \(115\)
parallelrisch \(-\frac {B \left (-2 b^{4} \left (\ln \left (\tan \left (d x +c \right )\right )-\ln \left (a +b \tan \left (d x +c \right )\right )\right )+a^{4} \left (-\ln \left (\sec \left (d x +c \right )^{2}\right )+2 \ln \left (\tan \left (d x +c \right )\right )\right )-2 x \,a^{3} b d +\cot \left (d x +c \right )^{2} a^{4}+a^{2} b^{2} \cot \left (d x +c \right )^{2}-2 a^{3} b \cot \left (d x +c \right )-2 a \,b^{3} \cot \left (d x +c \right )\right )}{2 \left (a^{2}+b^{2}\right ) a^{3} d}\) \(130\)
norman \(\frac {\frac {b^{2} B x \tan \left (d x +c \right )^{3}}{a^{2}+b^{2}}+\frac {B \,b^{2} \tan \left (d x +c \right )^{2}}{d \,a^{2}}+\frac {b B a x \tan \left (d x +c \right )^{2}}{a^{2}+b^{2}}-\frac {B}{2 d}+\frac {B b \tan \left (d x +c \right )}{2 a d}}{\tan \left (d x +c \right )^{2} \left (a +b \tan \left (d x +c \right )\right )}+\frac {B a \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {\left (a^{2}-b^{2}\right ) B \ln \left (\tan \left (d x +c \right )\right )}{a^{3} d}-\frac {B \,b^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{3} d \left (a^{2}+b^{2}\right )}\) \(194\)
risch \(\frac {i x B}{i b -a}+\frac {2 i x B}{a}+\frac {2 i B c}{a d}-\frac {2 i B \,b^{2} x}{a^{3}}-\frac {2 i B \,b^{2} c}{a^{3} d}+\frac {2 i b^{4} B x}{\left (a^{2}+b^{2}\right ) a^{3}}+\frac {2 i b^{4} B c}{\left (a^{2}+b^{2}\right ) a^{3} d}+\frac {2 i B \left (-i a \,{\mathrm e}^{2 i \left (d x +c \right )}+b \,{\mathrm e}^{2 i \left (d x +c \right )}-b \right )}{d \,a^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B \,b^{2}}{a^{3} d}-\frac {b^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{\left (a^{2}+b^{2}\right ) a^{3} d}\) \(249\)

Input:

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

Output:

1/d*B*(1/(a^2+b^2)*(1/2*a*ln(1+tan(d*x+c)^2)+b*arctan(tan(d*x+c)))-1/2/a/t 
an(d*x+c)^2+(-a^2+b^2)/a^3*ln(tan(d*x+c))+1/a^2*b/tan(d*x+c)-b^4/(a^2+b^2) 
/a^3*ln(a+b*tan(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 192, normalized size of antiderivative = 1.71 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {B b^{4} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )^{2} + B a^{4} + B a^{2} b^{2} + {\left (B a^{4} - B b^{4}\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )^{2} - {\left (2 \, B a^{3} b d x - B a^{4} - B a^{2} b^{2}\right )} \tan \left (d x + c\right )^{2} - 2 \, {\left (B a^{3} b + B a b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{5} + a^{3} b^{2}\right )} d \tan \left (d x + c\right )^{2}} \] Input:

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

Output:

-1/2*(B*b^4*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + 
 c)^2 + 1))*tan(d*x + c)^2 + B*a^4 + B*a^2*b^2 + (B*a^4 - B*b^4)*log(tan(d 
*x + c)^2/(tan(d*x + c)^2 + 1))*tan(d*x + c)^2 - (2*B*a^3*b*d*x - B*a^4 - 
B*a^2*b^2)*tan(d*x + c)^2 - 2*(B*a^3*b + B*a*b^3)*tan(d*x + c))/((a^5 + a^ 
3*b^2)*d*tan(d*x + c)^2)
 

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 3.95 (sec) , antiderivative size = 1401, normalized size of antiderivative = 12.51 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\text {Too large to display} \] Input:

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

Output:

Piecewise((zoo*B*x, Eq(a, 0) & Eq(b, 0) & Eq(c, 0) & Eq(d, 0)), (B*(log(ta 
n(c + d*x)**2 + 1)/(2*d) - log(tan(c + d*x))/d - 1/(2*d*tan(c + d*x)**2))/ 
a, Eq(b, 0)), (B*(x + 1/(d*tan(c + d*x)) - 1/(3*d*tan(c + d*x)**3))/b, Eq( 
a, 0)), (-3*I*B*d*x*tan(c + d*x)**3/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*tan(c 
 + d*x)**2) + 3*B*d*x*tan(c + d*x)**2/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*tan 
(c + d*x)**2) + 2*B*log(tan(c + d*x)**2 + 1)*tan(c + d*x)**3/(2*a*d*tan(c 
+ d*x)**3 + 2*I*a*d*tan(c + d*x)**2) + 2*I*B*log(tan(c + d*x)**2 + 1)*tan( 
c + d*x)**2/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*tan(c + d*x)**2) - 4*B*log(ta 
n(c + d*x))*tan(c + d*x)**3/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*tan(c + d*x)* 
*2) - 4*I*B*log(tan(c + d*x))*tan(c + d*x)**2/(2*a*d*tan(c + d*x)**3 + 2*I 
*a*d*tan(c + d*x)**2) - 3*I*B*tan(c + d*x)**2/(2*a*d*tan(c + d*x)**3 + 2*I 
*a*d*tan(c + d*x)**2) + B*tan(c + d*x)/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*ta 
n(c + d*x)**2) - I*B/(2*a*d*tan(c + d*x)**3 + 2*I*a*d*tan(c + d*x)**2), Eq 
(b, -I*a)), (3*I*B*d*x*tan(c + d*x)**3/(2*a*d*tan(c + d*x)**3 - 2*I*a*d*ta 
n(c + d*x)**2) + 3*B*d*x*tan(c + d*x)**2/(2*a*d*tan(c + d*x)**3 - 2*I*a*d* 
tan(c + d*x)**2) + 2*B*log(tan(c + d*x)**2 + 1)*tan(c + d*x)**3/(2*a*d*tan 
(c + d*x)**3 - 2*I*a*d*tan(c + d*x)**2) - 2*I*B*log(tan(c + d*x)**2 + 1)*t 
an(c + d*x)**2/(2*a*d*tan(c + d*x)**3 - 2*I*a*d*tan(c + d*x)**2) - 4*B*log 
(tan(c + d*x))*tan(c + d*x)**3/(2*a*d*tan(c + d*x)**3 - 2*I*a*d*tan(c + d* 
x)**2) + 4*I*B*log(tan(c + d*x))*tan(c + d*x)**2/(2*a*d*tan(c + d*x)**3...
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.16 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B b^{4} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{5} + a^{3} b^{2}} - \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} - \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{2} - B b^{2}\right )} \log \left (\tan \left (d x + c\right )\right )}{a^{3}} - \frac {2 \, B b \tan \left (d x + c\right ) - B a}{a^{2} \tan \left (d x + c\right )^{2}}}{2 \, d} \] Input:

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

Output:

-1/2*(2*B*b^4*log(b*tan(d*x + c) + a)/(a^5 + a^3*b^2) - 2*(d*x + c)*B*b/(a 
^2 + b^2) - B*a*log(tan(d*x + c)^2 + 1)/(a^2 + b^2) + 2*(B*a^2 - B*b^2)*lo 
g(tan(d*x + c))/a^3 - (2*B*b*tan(d*x + c) - B*a)/(a^2*tan(d*x + c)^2))/d
 

Giac [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.28 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {1}{2} \, {\left (\frac {2 \, b^{5} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{5} b d + a^{3} b^{3} d} - \frac {2 \, {\left (d x + c\right )} b}{a^{2} d + b^{2} d} - \frac {a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} d + b^{2} d} + \frac {2 \, {\left (a^{2} - b^{2}\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a^{3} d} - \frac {2 \, a b \tan \left (d x + c\right ) - a^{2}}{a^{3} d \tan \left (d x + c\right )^{2}}\right )} B \] Input:

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

Output:

-1/2*(2*b^5*log(abs(b*tan(d*x + c) + a))/(a^5*b*d + a^3*b^3*d) - 2*(d*x + 
c)*b/(a^2*d + b^2*d) - a*log(tan(d*x + c)^2 + 1)/(a^2*d + b^2*d) + 2*(a^2 
- b^2)*log(abs(tan(d*x + c)))/(a^3*d) - (2*a*b*tan(d*x + c) - a^2)/(a^3*d* 
tan(d*x + c)^2))*B
 

Mupad [B] (verification not implemented)

Time = 3.65 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.28 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {{\mathrm {cot}\left (c+d\,x\right )}^2\,\left (\frac {B}{2\,a}-\frac {B\,b\,\mathrm {tan}\left (c+d\,x\right )}{a^2}\right )}{d}+\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (a^2-b^2\right )}{a^3\,d}-\frac {B\,b^4\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{d\,\left (a^5+a^3\,b^2\right )}+\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )} \] Input:

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

Output:

(B*log(tan(c + d*x) + 1i))/(2*d*(a - b*1i)) - (cot(c + d*x)^2*(B/(2*a) - ( 
B*b*tan(c + d*x))/a^2))/d + (B*log(tan(c + d*x) - 1i)*1i)/(2*d*(a*1i - b)) 
 - (B*log(tan(c + d*x))*(a^2 - b^2))/(a^3*d) - (B*b^4*log(a + b*tan(c + d* 
x)))/(d*(a^5 + a^3*b^2))
 

Reduce [B] (verification not implemented)

Time = 30.00 (sec) , antiderivative size = 235, normalized size of antiderivative = 2.10 \[ \int \frac {\cot ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {b \left (4 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a^{3} b +4 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a \,b^{3}+4 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right )^{2} a^{4}-4 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b -a \right ) \sin \left (d x +c \right )^{2} b^{4}-4 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{2} a^{4}+4 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{2} b^{4}+\sin \left (d x +c \right )^{2} a^{4}+4 \sin \left (d x +c \right )^{2} a^{3} b d x +\sin \left (d x +c \right )^{2} a^{2} b^{2}-2 a^{4}-2 a^{2} b^{2}\right )}{4 \sin \left (d x +c \right )^{2} a^{3} d \left (a^{2}+b^{2}\right )} \] Input:

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

Output:

(b*(4*cos(c + d*x)*sin(c + d*x)*a**3*b + 4*cos(c + d*x)*sin(c + d*x)*a*b** 
3 + 4*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*a**4 - 4*log(tan((c + d 
*x)/2)**2*a - 2*tan((c + d*x)/2)*b - a)*sin(c + d*x)**2*b**4 - 4*log(tan(( 
c + d*x)/2))*sin(c + d*x)**2*a**4 + 4*log(tan((c + d*x)/2))*sin(c + d*x)** 
2*b**4 + sin(c + d*x)**2*a**4 + 4*sin(c + d*x)**2*a**3*b*d*x + sin(c + d*x 
)**2*a**2*b**2 - 2*a**4 - 2*a**2*b**2))/(4*sin(c + d*x)**2*a**3*d*(a**2 + 
b**2))