3.721 \(\int \frac{(a+b \cot (x))^2 \csc ^2(x)}{c+d \cot (x)} \, dx\)

Optimal. Leaf size=53 \[ \frac{b \cot (x) (b c-a d)}{d^2}-\frac{(b c-a d)^2 \log (c+d \cot (x))}{d^3}-\frac{(a+b \cot (x))^2}{2 d} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.136435, antiderivative size = 53, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.095, Rules used = {4344, 43} \[ \frac{b \cot (x) (b c-a d)}{d^2}-\frac{(b c-a d)^2 \log (c+d \cot (x))}{d^3}-\frac{(a+b \cot (x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 4344

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Cot[c*(a + b*x)], x]}, -Dist[d
/(b*c), Subst[Int[SubstFor[1, Cot[c*(a + b*x)]/d, u, x], x], x, Cot[c*(a + b*x)]/d], x] /; FunctionOfQ[Cot[c*(
a + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Csc] || EqQ[F, csc])

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \frac{(a+b \cot (x))^2 \csc ^2(x)}{c+d \cot (x)} \, dx &=-\operatorname{Subst}\left (\int \frac{(a+b x)^2}{c+d x} \, dx,x,\cot (x)\right )\\ &=-\operatorname{Subst}\left (\int \left (-\frac{b (b c-a d)}{d^2}+\frac{b (a+b x)}{d}+\frac{(-b c+a d)^2}{d^2 (c+d x)}\right ) \, dx,x,\cot (x)\right )\\ &=\frac{b (b c-a d) \cot (x)}{d^2}-\frac{(a+b \cot (x))^2}{2 d}-\frac{(b c-a d)^2 \log (c+d \cot (x))}{d^3}\\ \end{align*}

Mathematica [A]  time = 0.505196, size = 62, normalized size = 1.17 \[ \frac{2 b d \cot (x) (b c-2 a d)+2 (b c-a d)^2 (\log (\sin (x))-\log (c \sin (x)+d \cos (x)))-b^2 d^2 \csc ^2(x)}{2 d^3} \]

Antiderivative was successfully verified.

[In]

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

[Out]

(2*b*d*(b*c - 2*a*d)*Cot[x] - b^2*d^2*Csc[x]^2 + 2*(b*c - a*d)^2*(Log[Sin[x]] - Log[d*Cos[x] + c*Sin[x]]))/(2*
d^3)

________________________________________________________________________________________

Maple [B]  time = 0.065, size = 119, normalized size = 2.3 \begin{align*} -{\frac{{b}^{2}}{2\,d \left ( \tan \left ( x \right ) \right ) ^{2}}}+{\frac{\ln \left ( \tan \left ( x \right ) \right ){a}^{2}}{d}}-2\,{\frac{\ln \left ( \tan \left ( x \right ) \right ) bac}{{d}^{2}}}+{\frac{\ln \left ( \tan \left ( x \right ) \right ){b}^{2}{c}^{2}}{{d}^{3}}}-2\,{\frac{ab}{d\tan \left ( x \right ) }}+{\frac{c{b}^{2}}{{d}^{2}\tan \left ( x \right ) }}-{\frac{\ln \left ( c\tan \left ( x \right ) +d \right ){a}^{2}}{d}}+2\,{\frac{\ln \left ( c\tan \left ( x \right ) +d \right ) bac}{{d}^{2}}}-{\frac{\ln \left ( c\tan \left ( x \right ) +d \right ){b}^{2}{c}^{2}}{{d}^{3}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*b^2/d/tan(x)^2+1/d*ln(tan(x))*a^2-2/d^2*ln(tan(x))*b*a*c+1/d^3*ln(tan(x))*b^2*c^2-2*b/d/tan(x)*a+b^2/d^2/
tan(x)*c-1/d*ln(c*tan(x)+d)*a^2+2/d^2*ln(c*tan(x)+d)*b*a*c-1/d^3*ln(c*tan(x)+d)*b^2*c^2

________________________________________________________________________________________

Maxima [A]  time = 0.973524, size = 124, normalized size = 2.34 \begin{align*} -\frac{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (c \tan \left (x\right ) + d\right )}{d^{3}} + \frac{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (\tan \left (x\right )\right )}{d^{3}} - \frac{b^{2} d - 2 \,{\left (b^{2} c - 2 \, a b d\right )} \tan \left (x\right )}{2 \, d^{2} \tan \left (x\right )^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 3.29222, size = 417, normalized size = 7.87 \begin{align*} \frac{b^{2} d^{2} - 2 \,{\left (b^{2} c d - 2 \, a b d^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) +{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} -{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cos \left (x\right )^{2}\right )} \log \left (2 \, c d \cos \left (x\right ) \sin \left (x\right ) -{\left (c^{2} - d^{2}\right )} \cos \left (x\right )^{2} + c^{2}\right ) -{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2} -{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cos \left (x\right )^{2}\right )} \log \left (-\frac{1}{4} \, \cos \left (x\right )^{2} + \frac{1}{4}\right )}{2 \,{\left (d^{3} \cos \left (x\right )^{2} - d^{3}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 28.6935, size = 58, normalized size = 1.09 \begin{align*} - \frac{b^{2} \cot ^{2}{\left (x \right )}}{2 d} - \frac{\left (a d - b c\right )^{2} \left (\begin{cases} \frac{\cot{\left (x \right )}}{c} & \text{for}\: d = 0 \\\frac{\log{\left (c + d \cot{\left (x \right )} \right )}}{d} & \text{otherwise} \end{cases}\right )}{d^{2}} - \frac{\left (2 a b d - b^{2} c\right ) \cot{\left (x \right )}}{d^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-b**2*cot(x)**2/(2*d) - (a*d - b*c)**2*Piecewise((cot(x)/c, Eq(d, 0)), (log(c + d*cot(x))/d, True))/d**2 - (2*
a*b*d - b**2*c)*cot(x)/d**2

________________________________________________________________________________________

Giac [B]  time = 1.19983, size = 188, normalized size = 3.55 \begin{align*} \frac{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | \tan \left (x\right ) \right |}\right )}{d^{3}} - \frac{{\left (b^{2} c^{3} - 2 \, a b c^{2} d + a^{2} c d^{2}\right )} \log \left ({\left | c \tan \left (x\right ) + d \right |}\right )}{c d^{3}} - \frac{3 \, b^{2} c^{2} \tan \left (x\right )^{2} - 6 \, a b c d \tan \left (x\right )^{2} + 3 \, a^{2} d^{2} \tan \left (x\right )^{2} - 2 \, b^{2} c d \tan \left (x\right ) + 4 \, a b d^{2} \tan \left (x\right ) + b^{2} d^{2}}{2 \, d^{3} \tan \left (x\right )^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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