Optimal. Leaf size=77 \[ -\frac {1}{2} a^2 b \cos (x)-\frac {1}{4} (2 a-b) (a+b)^2 \log (1-\cos (x))-\frac {1}{4} (a-b)^2 (2 a+b) \log (\cos (x)+1)-\frac {1}{2} \csc ^2(x) (a \cos (x)+b)^2 (a+b \cos (x)) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.14, antiderivative size = 77, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.546, Rules used = {4392, 2668, 739, 774, 633, 31} \[ -\frac {1}{2} a^2 b \cos (x)-\frac {1}{4} (2 a-b) (a+b)^2 \log (1-\cos (x))-\frac {1}{4} (a-b)^2 (2 a+b) \log (\cos (x)+1)-\frac {1}{2} \csc ^2(x) (a \cos (x)+b)^2 (a+b \cos (x)) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 633
Rule 739
Rule 774
Rule 2668
Rule 4392
Rubi steps
\begin {align*} \int (a \cot (x)+b \csc (x))^3 \, dx &=\int (b+a \cos (x))^3 \csc ^3(x) \, dx\\ &=-\left (a^3 \operatorname {Subst}\left (\int \frac {(b+x)^3}{\left (a^2-x^2\right )^2} \, dx,x,a \cos (x)\right )\right )\\ &=-\frac {1}{2} (b+a \cos (x))^2 (a+b \cos (x)) \csc ^2(x)+\frac {1}{2} a \operatorname {Subst}\left (\int \frac {(b+x) \left (2 a^2-b^2+b x\right )}{a^2-x^2} \, dx,x,a \cos (x)\right )\\ &=-\frac {1}{2} a^2 b \cos (x)-\frac {1}{2} (b+a \cos (x))^2 (a+b \cos (x)) \csc ^2(x)-\frac {1}{2} a \operatorname {Subst}\left (\int \frac {-a^2 b-b \left (2 a^2-b^2\right )-2 a^2 x}{a^2-x^2} \, dx,x,a \cos (x)\right )\\ &=-\frac {1}{2} a^2 b \cos (x)-\frac {1}{2} (b+a \cos (x))^2 (a+b \cos (x)) \csc ^2(x)+\frac {1}{4} \left ((2 a-b) (a+b)^2\right ) \operatorname {Subst}\left (\int \frac {1}{a-x} \, dx,x,a \cos (x)\right )+\frac {1}{4} \left ((a-b)^2 (2 a+b)\right ) \operatorname {Subst}\left (\int \frac {1}{-a-x} \, dx,x,a \cos (x)\right )\\ &=-\frac {1}{2} a^2 b \cos (x)-\frac {1}{2} (b+a \cos (x))^2 (a+b \cos (x)) \csc ^2(x)-\frac {1}{4} (2 a-b) (a+b)^2 \log (1-\cos (x))-\frac {1}{4} (a-b)^2 (2 a+b) \log (1+\cos (x))\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.29, size = 79, normalized size = 1.03 \[ \frac {1}{8} \left (-(a+b)^3 \csc ^2\left (\frac {x}{2}\right )+(a-b)^3 \left (-\sec ^2\left (\frac {x}{2}\right )\right )-4 (2 a-b) (a+b)^2 \log \left (\sin \left (\frac {x}{2}\right )\right )-4 (2 a+b) (a-b)^2 \log \left (\cos \left (\frac {x}{2}\right )\right )\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.97, size = 128, normalized size = 1.66 \[ \frac {2 \, a^{3} + 6 \, a b^{2} + 2 \, {\left (3 \, a^{2} b + b^{3}\right )} \cos \relax (x) + {\left (2 \, a^{3} - 3 \, a^{2} b + b^{3} - {\left (2 \, a^{3} - 3 \, a^{2} b + b^{3}\right )} \cos \relax (x)^{2}\right )} \log \left (\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) + {\left (2 \, a^{3} + 3 \, a^{2} b - b^{3} - {\left (2 \, a^{3} + 3 \, a^{2} b - b^{3}\right )} \cos \relax (x)^{2}\right )} \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right )}{4 \, {\left (\cos \relax (x)^{2} - 1\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.15, size = 86, normalized size = 1.12 \[ -\frac {1}{4} \, {\left (2 \, a^{3} - 3 \, a^{2} b + b^{3}\right )} \log \left (\cos \relax (x) + 1\right ) - \frac {1}{4} \, {\left (2 \, a^{3} + 3 \, a^{2} b - b^{3}\right )} \log \left (-\cos \relax (x) + 1\right ) + \frac {a^{3} + 3 \, a b^{2} + {\left (3 \, a^{2} b + b^{3}\right )} \cos \relax (x)}{2 \, {\left (\cos \relax (x) + 1\right )} {\left (\cos \relax (x) - 1\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.07, size = 87, normalized size = 1.13 \[ -\frac {a^{3} \left (\cot ^{2}\relax (x )\right )}{2}-a^{3} \ln \left (\sin \relax (x )\right )-\frac {3 a^{2} b \left (\cos ^{3}\relax (x )\right )}{2 \sin \relax (x )^{2}}-\frac {3 a^{2} b \cos \relax (x )}{2}-\frac {3 a^{2} b \ln \left (\csc \relax (x )-\cot \relax (x )\right )}{2}-\frac {3 a \,b^{2}}{2 \sin \relax (x )^{2}}-\frac {b^{3} \csc \relax (x ) \cot \relax (x )}{2}+\frac {b^{3} \ln \left (\csc \relax (x )-\cot \relax (x )\right )}{2} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.31, size = 87, normalized size = 1.13 \[ -\frac {3}{2} \, a b^{2} \cot \relax (x)^{2} + \frac {3}{4} \, a^{2} b {\left (\frac {2 \, \cos \relax (x)}{\cos \relax (x)^{2} - 1} + \log \left (\cos \relax (x) + 1\right ) - \log \left (\cos \relax (x) - 1\right )\right )} + \frac {1}{4} \, b^{3} {\left (\frac {2 \, \cos \relax (x)}{\cos \relax (x)^{2} - 1} - \log \left (\cos \relax (x) + 1\right ) + \log \left (\cos \relax (x) - 1\right )\right )} - \frac {1}{2} \, a^{3} {\left (\frac {1}{\sin \relax (x)^{2}} + \log \left (\sin \relax (x)^{2}\right )\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.45, size = 82, normalized size = 1.06 \[ a^3\,\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )-\frac {\frac {a^3}{8}+\frac {3\,a^2\,b}{8}+\frac {3\,a\,b^2}{8}+\frac {b^3}{8}}{{\mathrm {tan}\left (\frac {x}{2}\right )}^2}-\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )\,\left (a^3+\frac {3\,a^2\,b}{2}-\frac {b^3}{2}\right )-\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^2\,{\left (a-b\right )}^3}{8} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 14.11, size = 124, normalized size = 1.61 \[ \frac {a^{3} \log {\left (- \csc ^{2}{\relax (x )} \right )}}{2} - \frac {a^{3} \csc ^{2}{\relax (x )}}{2} - \frac {3 a^{2} b \log {\left (\cos {\relax (x )} - 1 \right )}}{4} + \frac {3 a^{2} b \log {\left (\cos {\relax (x )} + 1 \right )}}{4} + \frac {3 a^{2} b \cos {\relax (x )}}{2 \cos ^{2}{\relax (x )} - 2} - \frac {3 a b^{2} \csc ^{2}{\relax (x )}}{2} + \frac {b^{3} \log {\left (\cos {\relax (x )} - 1 \right )}}{4} - \frac {b^{3} \log {\left (\cos {\relax (x )} + 1 \right )}}{4} + \frac {b^{3} \cos {\relax (x )}}{2 \cos ^{2}{\relax (x )} - 2} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________