\(\int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx\) [41]

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

Optimal result

Integrand size = 20, antiderivative size = 90 \[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=-\frac {4 d (c+d x) \text {arctanh}\left (e^{i (a+b x)}\right )}{b^2}-\frac {(c+d x)^2 \csc (a+b x)}{b}+\frac {2 i d^2 \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^3}-\frac {2 i d^2 \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^3} \] Output:

-4*d*(d*x+c)*arctanh(exp(I*(b*x+a)))/b^2-(d*x+c)^2*csc(b*x+a)/b+2*I*d^2*po 
lylog(2,-exp(I*(b*x+a)))/b^3-2*I*d^2*polylog(2,exp(I*(b*x+a)))/b^3
 

Mathematica [B] (warning: unable to verify)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(234\) vs. \(2(90)=180\).

Time = 1.50 (sec) , antiderivative size = 234, normalized size of antiderivative = 2.60 \[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\frac {-8 b c d \text {arctanh}\left (\cos (a)-\sin (a) \tan \left (\frac {b x}{2}\right )\right )-2 b^2 (c+d x)^2 \csc (a)+4 d^2 \left (2 \arctan (\tan (a)) \text {arctanh}\left (\cos (a)-\sin (a) \tan \left (\frac {b x}{2}\right )\right )+\frac {\left ((b x+\arctan (\tan (a))) \left (\log \left (1-e^{i (b x+\arctan (\tan (a)))}\right )-\log \left (1+e^{i (b x+\arctan (\tan (a)))}\right )\right )+i \operatorname {PolyLog}\left (2,-e^{i (b x+\arctan (\tan (a)))}\right )-i \operatorname {PolyLog}\left (2,e^{i (b x+\arctan (\tan (a)))}\right )\right ) \sec (a)}{\sqrt {\sec ^2(a)}}\right )+b^2 (c+d x)^2 \csc \left (\frac {a}{2}\right ) \csc \left (\frac {1}{2} (a+b x)\right ) \sin \left (\frac {b x}{2}\right )-b^2 (c+d x)^2 \sec \left (\frac {a}{2}\right ) \sec \left (\frac {1}{2} (a+b x)\right ) \sin \left (\frac {b x}{2}\right )}{2 b^3} \] Input:

Integrate[(c + d*x)^2*Cot[a + b*x]*Csc[a + b*x],x]
 

Output:

(-8*b*c*d*ArcTanh[Cos[a] - Sin[a]*Tan[(b*x)/2]] - 2*b^2*(c + d*x)^2*Csc[a] 
 + 4*d^2*(2*ArcTan[Tan[a]]*ArcTanh[Cos[a] - Sin[a]*Tan[(b*x)/2]] + (((b*x 
+ ArcTan[Tan[a]])*(Log[1 - E^(I*(b*x + ArcTan[Tan[a]]))] - Log[1 + E^(I*(b 
*x + ArcTan[Tan[a]]))]) + I*PolyLog[2, -E^(I*(b*x + ArcTan[Tan[a]]))] - I* 
PolyLog[2, E^(I*(b*x + ArcTan[Tan[a]]))])*Sec[a])/Sqrt[Sec[a]^2]) + b^2*(c 
 + d*x)^2*Csc[a/2]*Csc[(a + b*x)/2]*Sin[(b*x)/2] - b^2*(c + d*x)^2*Sec[a/2 
]*Sec[(a + b*x)/2]*Sin[(b*x)/2])/(2*b^3)
 

Rubi [A] (verified)

Time = 0.37 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.02, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {4910, 3042, 4671, 2715, 2838}

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 (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx\)

\(\Big \downarrow \) 4910

\(\displaystyle \frac {2 d \int (c+d x) \csc (a+b x)dx}{b}-\frac {(c+d x)^2 \csc (a+b x)}{b}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 d \int (c+d x) \csc (a+b x)dx}{b}-\frac {(c+d x)^2 \csc (a+b x)}{b}\)

\(\Big \downarrow \) 4671

\(\displaystyle -\frac {(c+d x)^2 \csc (a+b x)}{b}+\frac {2 d \left (-\frac {d \int \log \left (1-e^{i (a+b x)}\right )dx}{b}+\frac {d \int \log \left (1+e^{i (a+b x)}\right )dx}{b}-\frac {2 (c+d x) \text {arctanh}\left (e^{i (a+b x)}\right )}{b}\right )}{b}\)

\(\Big \downarrow \) 2715

\(\displaystyle -\frac {(c+d x)^2 \csc (a+b x)}{b}+\frac {2 d \left (\frac {i d \int e^{-i (a+b x)} \log \left (1-e^{i (a+b x)}\right )de^{i (a+b x)}}{b^2}-\frac {i d \int e^{-i (a+b x)} \log \left (1+e^{i (a+b x)}\right )de^{i (a+b x)}}{b^2}-\frac {2 (c+d x) \text {arctanh}\left (e^{i (a+b x)}\right )}{b}\right )}{b}\)

\(\Big \downarrow \) 2838

\(\displaystyle -\frac {(c+d x)^2 \csc (a+b x)}{b}+\frac {2 d \left (-\frac {2 (c+d x) \text {arctanh}\left (e^{i (a+b x)}\right )}{b}+\frac {i d \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {i d \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}\right )}{b}\)

Input:

Int[(c + d*x)^2*Cot[a + b*x]*Csc[a + b*x],x]
 

Output:

-(((c + d*x)^2*Csc[a + b*x])/b) + (2*d*((-2*(c + d*x)*ArcTanh[E^(I*(a + b* 
x))])/b + (I*d*PolyLog[2, -E^(I*(a + b*x))])/b^2 - (I*d*PolyLog[2, E^(I*(a 
 + b*x))])/b^2))/b
 

Defintions of rubi rules used

rule 2715
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] 
:> Simp[1/(d*e*n*Log[F])   Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) 
))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

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

rule 4671
Int[csc[(e_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[- 
2*(c + d*x)^m*(ArcTanh[E^(I*(e + f*x))]/f), x] + (-Simp[d*(m/f)   Int[(c + 
d*x)^(m - 1)*Log[1 - E^(I*(e + f*x))], x], x] + Simp[d*(m/f)   Int[(c + d*x 
)^(m - 1)*Log[1 + E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e, f}, x] && IG 
tQ[m, 0]
 

rule 4910
Int[Cot[(a_.) + (b_.)*(x_)]^(p_.)*Csc[(a_.) + (b_.)*(x_)]^(n_.)*((c_.) + (d 
_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(c + d*x)^m)*(Csc[a + b*x]^n/(b*n)), x 
] + Simp[d*(m/(b*n))   Int[(c + d*x)^(m - 1)*Csc[a + b*x]^n, x], x] /; Free 
Q[{a, b, c, d, n}, x] && EqQ[p, 1] && GtQ[m, 0]
 
Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 211 vs. \(2 (82 ) = 164\).

Time = 0.22 (sec) , antiderivative size = 212, normalized size of antiderivative = 2.36

method result size
risch \(-\frac {2 i \left (x^{2} d^{2}+2 c d x +c^{2}\right ) {\mathrm e}^{i \left (b x +a \right )}}{b \left ({\mathrm e}^{2 i \left (b x +a \right )}-1\right )}-\frac {4 d c \,\operatorname {arctanh}\left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}-\frac {2 d^{2} \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right ) x}{b^{2}}-\frac {2 d^{2} \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right ) a}{b^{3}}+\frac {2 i d^{2} \operatorname {polylog}\left (2, -{\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}+\frac {2 d^{2} \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right ) x}{b^{2}}+\frac {2 d^{2} \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right ) a}{b^{3}}-\frac {2 i d^{2} \operatorname {polylog}\left (2, {\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}+\frac {4 d^{2} a \,\operatorname {arctanh}\left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}\) \(212\)
derivativedivides \(\frac {-\frac {a^{2} d^{2}}{b^{2} \sin \left (b x +a \right )}+\frac {2 a c d}{b \sin \left (b x +a \right )}-\frac {2 a \,d^{2} \left (-\frac {b x +a}{\sin \left (b x +a \right )}+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )\right )}{b^{2}}-\frac {c^{2}}{\sin \left (b x +a \right )}+\frac {2 c d \left (-\frac {b x +a}{\sin \left (b x +a \right )}+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )\right )}{b}+\frac {d^{2} \left (-\frac {\left (b x +a \right )^{2}}{\sin \left (b x +a \right )}+2 \left (b x +a \right ) \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right )-2 \left (b x +a \right ) \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right )+2 i \operatorname {dilog}\left ({\mathrm e}^{i \left (b x +a \right )}+1\right )-2 i \operatorname {dilog}\left (1-{\mathrm e}^{i \left (b x +a \right )}\right )\right )}{b^{2}}}{b}\) \(231\)
default \(\frac {-\frac {a^{2} d^{2}}{b^{2} \sin \left (b x +a \right )}+\frac {2 a c d}{b \sin \left (b x +a \right )}-\frac {2 a \,d^{2} \left (-\frac {b x +a}{\sin \left (b x +a \right )}+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )\right )}{b^{2}}-\frac {c^{2}}{\sin \left (b x +a \right )}+\frac {2 c d \left (-\frac {b x +a}{\sin \left (b x +a \right )}+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )\right )}{b}+\frac {d^{2} \left (-\frac {\left (b x +a \right )^{2}}{\sin \left (b x +a \right )}+2 \left (b x +a \right ) \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right )-2 \left (b x +a \right ) \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right )+2 i \operatorname {dilog}\left ({\mathrm e}^{i \left (b x +a \right )}+1\right )-2 i \operatorname {dilog}\left (1-{\mathrm e}^{i \left (b x +a \right )}\right )\right )}{b^{2}}}{b}\) \(231\)

Input:

int((d*x+c)^2*cot(b*x+a)*csc(b*x+a),x,method=_RETURNVERBOSE)
 

Output:

-2*I*(d^2*x^2+2*c*d*x+c^2)*exp(I*(b*x+a))/b/(exp(2*I*(b*x+a))-1)-4*d/b^2*c 
*arctanh(exp(I*(b*x+a)))-2*d^2/b^2*ln(exp(I*(b*x+a))+1)*x-2*d^2/b^3*ln(exp 
(I*(b*x+a))+1)*a+2*I*d^2*polylog(2,-exp(I*(b*x+a)))/b^3+2*d^2/b^2*ln(1-exp 
(I*(b*x+a)))*x+2*d^2/b^3*ln(1-exp(I*(b*x+a)))*a-2*I*d^2*polylog(2,exp(I*(b 
*x+a)))/b^3+4*d^2/b^3*a*arctanh(exp(I*(b*x+a)))
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 375 vs. \(2 (78) = 156\).

Time = 0.09 (sec) , antiderivative size = 375, normalized size of antiderivative = 4.17 \[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=-\frac {b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2} + i \, d^{2} {\rm Li}_2\left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) \sin \left (b x + a\right ) - i \, d^{2} {\rm Li}_2\left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) \sin \left (b x + a\right ) + i \, d^{2} {\rm Li}_2\left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) \sin \left (b x + a\right ) - i \, d^{2} {\rm Li}_2\left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) \sin \left (b x + a\right ) + {\left (b d^{2} x + b c d\right )} \log \left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) \sin \left (b x + a\right ) + {\left (b d^{2} x + b c d\right )} \log \left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right ) \sin \left (b x + a\right ) - {\left (b c d - a d^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) \sin \left (b x + a\right ) - {\left (b c d - a d^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) - \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) \sin \left (b x + a\right ) - {\left (b d^{2} x + a d^{2}\right )} \log \left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) \sin \left (b x + a\right ) - {\left (b d^{2} x + a d^{2}\right )} \log \left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right ) \sin \left (b x + a\right )}{b^{3} \sin \left (b x + a\right )} \] Input:

integrate((d*x+c)^2*cot(b*x+a)*csc(b*x+a),x, algorithm="fricas")
 

Output:

-(b^2*d^2*x^2 + 2*b^2*c*d*x + b^2*c^2 + I*d^2*dilog(cos(b*x + a) + I*sin(b 
*x + a))*sin(b*x + a) - I*d^2*dilog(cos(b*x + a) - I*sin(b*x + a))*sin(b*x 
 + a) + I*d^2*dilog(-cos(b*x + a) + I*sin(b*x + a))*sin(b*x + a) - I*d^2*d 
ilog(-cos(b*x + a) - I*sin(b*x + a))*sin(b*x + a) + (b*d^2*x + b*c*d)*log( 
cos(b*x + a) + I*sin(b*x + a) + 1)*sin(b*x + a) + (b*d^2*x + b*c*d)*log(co 
s(b*x + a) - I*sin(b*x + a) + 1)*sin(b*x + a) - (b*c*d - a*d^2)*log(-1/2*c 
os(b*x + a) + 1/2*I*sin(b*x + a) + 1/2)*sin(b*x + a) - (b*c*d - a*d^2)*log 
(-1/2*cos(b*x + a) - 1/2*I*sin(b*x + a) + 1/2)*sin(b*x + a) - (b*d^2*x + a 
*d^2)*log(-cos(b*x + a) + I*sin(b*x + a) + 1)*sin(b*x + a) - (b*d^2*x + a* 
d^2)*log(-cos(b*x + a) - I*sin(b*x + a) + 1)*sin(b*x + a))/(b^3*sin(b*x + 
a))
 

Sympy [F]

\[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\int \left (c + d x\right )^{2} \cot {\left (a + b x \right )} \csc {\left (a + b x \right )}\, dx \] Input:

integrate((d*x+c)**2*cot(b*x+a)*csc(b*x+a),x)
 

Output:

Integral((c + d*x)**2*cot(a + b*x)*csc(a + b*x), x)
 

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 553 vs. \(2 (78) = 156\).

Time = 0.16 (sec) , antiderivative size = 553, normalized size of antiderivative = 6.14 \[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\frac {2 \, {\left (b d^{2} x + b c d - {\left (b d^{2} x + b c d\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (-i \, b d^{2} x - i \, b c d\right )} \sin \left (2 \, b x + 2 \, a\right )\right )} \arctan \left (\sin \left (b x + a\right ), \cos \left (b x + a\right ) + 1\right ) + 2 \, {\left (b c d \cos \left (2 \, b x + 2 \, a\right ) + i \, b c d \sin \left (2 \, b x + 2 \, a\right ) - b c d\right )} \arctan \left (\sin \left (b x + a\right ), \cos \left (b x + a\right ) - 1\right ) - 2 \, {\left (b d^{2} x \cos \left (2 \, b x + 2 \, a\right ) + i \, b d^{2} x \sin \left (2 \, b x + 2 \, a\right ) - b d^{2} x\right )} \arctan \left (\sin \left (b x + a\right ), -\cos \left (b x + a\right ) + 1\right ) - 2 \, {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2}\right )} \cos \left (b x + a\right ) + 2 \, {\left (d^{2} \cos \left (2 \, b x + 2 \, a\right ) + i \, d^{2} \sin \left (2 \, b x + 2 \, a\right ) - d^{2}\right )} {\rm Li}_2\left (-e^{\left (i \, b x + i \, a\right )}\right ) - 2 \, {\left (d^{2} \cos \left (2 \, b x + 2 \, a\right ) + i \, d^{2} \sin \left (2 \, b x + 2 \, a\right ) - d^{2}\right )} {\rm Li}_2\left (e^{\left (i \, b x + i \, a\right )}\right ) - {\left (i \, b d^{2} x + i \, b c d + {\left (-i \, b d^{2} x - i \, b c d\right )} \cos \left (2 \, b x + 2 \, a\right ) + {\left (b d^{2} x + b c d\right )} \sin \left (2 \, b x + 2 \, a\right )\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) - {\left (-i \, b d^{2} x - i \, b c d + {\left (i \, b d^{2} x + i \, b c d\right )} \cos \left (2 \, b x + 2 \, a\right ) - {\left (b d^{2} x + b c d\right )} \sin \left (2 \, b x + 2 \, a\right )\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) + 2 \, {\left (-i \, b^{2} d^{2} x^{2} - 2 i \, b^{2} c d x - i \, b^{2} c^{2}\right )} \sin \left (b x + a\right )}{-i \, b^{3} \cos \left (2 \, b x + 2 \, a\right ) + b^{3} \sin \left (2 \, b x + 2 \, a\right ) + i \, b^{3}} \] Input:

integrate((d*x+c)^2*cot(b*x+a)*csc(b*x+a),x, algorithm="maxima")
 

Output:

(2*(b*d^2*x + b*c*d - (b*d^2*x + b*c*d)*cos(2*b*x + 2*a) + (-I*b*d^2*x - I 
*b*c*d)*sin(2*b*x + 2*a))*arctan2(sin(b*x + a), cos(b*x + a) + 1) + 2*(b*c 
*d*cos(2*b*x + 2*a) + I*b*c*d*sin(2*b*x + 2*a) - b*c*d)*arctan2(sin(b*x + 
a), cos(b*x + a) - 1) - 2*(b*d^2*x*cos(2*b*x + 2*a) + I*b*d^2*x*sin(2*b*x 
+ 2*a) - b*d^2*x)*arctan2(sin(b*x + a), -cos(b*x + a) + 1) - 2*(b^2*d^2*x^ 
2 + 2*b^2*c*d*x + b^2*c^2)*cos(b*x + a) + 2*(d^2*cos(2*b*x + 2*a) + I*d^2* 
sin(2*b*x + 2*a) - d^2)*dilog(-e^(I*b*x + I*a)) - 2*(d^2*cos(2*b*x + 2*a) 
+ I*d^2*sin(2*b*x + 2*a) - d^2)*dilog(e^(I*b*x + I*a)) - (I*b*d^2*x + I*b* 
c*d + (-I*b*d^2*x - I*b*c*d)*cos(2*b*x + 2*a) + (b*d^2*x + b*c*d)*sin(2*b* 
x + 2*a))*log(cos(b*x + a)^2 + sin(b*x + a)^2 + 2*cos(b*x + a) + 1) - (-I* 
b*d^2*x - I*b*c*d + (I*b*d^2*x + I*b*c*d)*cos(2*b*x + 2*a) - (b*d^2*x + b* 
c*d)*sin(2*b*x + 2*a))*log(cos(b*x + a)^2 + sin(b*x + a)^2 - 2*cos(b*x + a 
) + 1) + 2*(-I*b^2*d^2*x^2 - 2*I*b^2*c*d*x - I*b^2*c^2)*sin(b*x + a))/(-I* 
b^3*cos(2*b*x + 2*a) + b^3*sin(2*b*x + 2*a) + I*b^3)
 

Giac [F]

\[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\int { {\left (d x + c\right )}^{2} \cot \left (b x + a\right ) \csc \left (b x + a\right ) \,d x } \] Input:

integrate((d*x+c)^2*cot(b*x+a)*csc(b*x+a),x, algorithm="giac")
 

Output:

integrate((d*x + c)^2*cot(b*x + a)*csc(b*x + a), x)
 

Mupad [F(-1)]

Timed out. \[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\int \frac {\mathrm {cot}\left (a+b\,x\right )\,{\left (c+d\,x\right )}^2}{\sin \left (a+b\,x\right )} \,d x \] Input:

int((cot(a + b*x)*(c + d*x)^2)/sin(a + b*x),x)
 

Output:

int((cot(a + b*x)*(c + d*x)^2)/sin(a + b*x), x)
 

Reduce [F]

\[ \int (c+d x)^2 \cot (a+b x) \csc (a+b x) \, dx=\frac {\cos \left (b x +a \right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b \,d^{2} x^{2}+2 \left (\int \frac {x}{\tan \left (\frac {b x}{2}+\frac {a}{2}\right )}d x \right ) \sin \left (b x +a \right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b \,d^{2}+2 \left (\int \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) x d x \right ) \sin \left (b x +a \right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b \,d^{2}+4 \,\mathrm {log}\left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )\right ) \sin \left (b x +a \right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) c d -\sin \left (b x +a \right ) b \,d^{2} x^{2}-2 \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b \,c^{2}-4 \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b c d x -\tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b \,d^{2} x^{2}}{2 \sin \left (b x +a \right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) b^{2}} \] Input:

int((d*x+c)^2*cot(b*x+a)*csc(b*x+a),x)
 

Output:

(cos(a + b*x)*tan((a + b*x)/2)*b*d**2*x**2 + 2*int(x/tan((a + b*x)/2),x)*s 
in(a + b*x)*tan((a + b*x)/2)*b*d**2 + 2*int(tan((a + b*x)/2)*x,x)*sin(a + 
b*x)*tan((a + b*x)/2)*b*d**2 + 4*log(tan((a + b*x)/2))*sin(a + b*x)*tan((a 
 + b*x)/2)*c*d - sin(a + b*x)*b*d**2*x**2 - 2*tan((a + b*x)/2)*b*c**2 - 4* 
tan((a + b*x)/2)*b*c*d*x - tan((a + b*x)/2)*b*d**2*x**2)/(2*sin(a + b*x)*t 
an((a + b*x)/2)*b**2)