Optimal. Leaf size=29 \[ a^2 (-x)-a b \sin (x)-\csc (x) (a \cos (x)+b) (a+b \cos (x)) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.056306, antiderivative size = 29, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.273, Rules used = {4392, 2691, 2637} \[ a^2 (-x)-a b \sin (x)-\csc (x) (a \cos (x)+b) (a+b \cos (x)) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4392
Rule 2691
Rule 2637
Rubi steps
\begin{align*} \int (a \cot (x)+b \csc (x))^2 \, dx &=\int (b+a \cos (x))^2 \csc ^2(x) \, dx\\ &=-(b+a \cos (x)) (a+b \cos (x)) \csc (x)-\int \left (a^2+a b \cos (x)\right ) \, dx\\ &=-a^2 x-(b+a \cos (x)) (a+b \cos (x)) \csc (x)-(a b) \int \cos (x) \, dx\\ &=-a^2 x-(b+a \cos (x)) (a+b \cos (x)) \csc (x)-a b \sin (x)\\ \end{align*}
Mathematica [A] time = 0.129501, size = 24, normalized size = 0.83 \[ -\left (a^2+b^2\right ) \cot (x)-a (a x+2 b \csc (x)) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.014, size = 29, normalized size = 1. \begin{align*}{a}^{2} \left ( -\cot \left ( x \right ) -x \right ) -2\,{\frac{ab}{\sin \left ( x \right ) }}-{b}^{2}\cot \left ( x \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.48353, size = 39, normalized size = 1.34 \begin{align*} -a^{2}{\left (x + \frac{1}{\tan \left (x\right )}\right )} - \frac{2 \, a b}{\sin \left (x\right )} - \frac{b^{2}}{\tan \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.95012, size = 72, normalized size = 2.48 \begin{align*} -\frac{a^{2} x \sin \left (x\right ) + 2 \, a b +{\left (a^{2} + b^{2}\right )} \cos \left (x\right )}{\sin \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 7.40745, size = 31, normalized size = 1.07 \begin{align*} - a^{2} x - \frac{a^{2} \cos{\left (x \right )}}{\sin{\left (x \right )}} - 2 a b \csc{\left (x \right )} - b^{2} \cot{\left (x \right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.14155, size = 70, normalized size = 2.41 \begin{align*} -a^{2} x + \frac{1}{2} \, a^{2} \tan \left (\frac{1}{2} \, x\right ) - a b \tan \left (\frac{1}{2} \, x\right ) + \frac{1}{2} \, b^{2} \tan \left (\frac{1}{2} \, x\right ) - \frac{a^{2} + 2 \, a b + b^{2}}{2 \, \tan \left (\frac{1}{2} \, x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]