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.06, antiderivative size = 29, normalized size of antiderivative = 1.00, 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 2637
Rule 2691
Rule 4392
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.13, size = 24, normalized size = 0.83 \[ -\left (\left (a^2+b^2\right ) \cot (x)\right )-a (a x+2 b \csc (x)) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.92, size = 28, normalized size = 0.97 \[ -\frac {a^{2} x \sin \relax (x) + 2 \, a b + {\left (a^{2} + b^{2}\right )} \cos \relax (x)}{\sin \relax (x)} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.15, size = 52, normalized size = 1.79 \[ -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 )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.04, size = 29, normalized size = 1.00 \[ a^{2} \left (-\cot \relax (x )-x \right )-\frac {2 a b}{\sin \relax (x )}-b^{2} \cot \relax (x ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.42, size = 29, normalized size = 1.00 \[ -a^{2} {\left (x + \frac {1}{\tan \relax (x)}\right )} - \frac {2 \, a b}{\sin \relax (x)} - \frac {b^{2}}{\tan \relax (x)} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.42, size = 30, normalized size = 1.03 \[ -\frac {\cos \relax (x)\,a^2+2\,a\,b+\cos \relax (x)\,b^2}{\sin \relax (x)}-a^2\,x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 2.79, size = 31, normalized size = 1.07 \[ - a^{2} x - \frac {a^{2} \cos {\relax (x )}}{\sin {\relax (x )}} - 2 a b \csc {\relax (x )} - b^{2} \cot {\relax (x )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________