Optimal. Leaf size=181 \[ \frac {a \left (a^2+28 b^2\right ) \cos (c+d x)}{6 b d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}+\frac {\left (2 a^2+39 b^2\right ) \sin (c+d x) \cos (c+d x)}{24 d}-\frac {3}{8} x \left (4 a^2-b^2\right )-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.52, antiderivative size = 181, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {2894, 3049, 3033, 3023, 2735, 3770} \[ \frac {a \left (a^2+28 b^2\right ) \cos (c+d x)}{6 b d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}+\frac {\left (2 a^2+39 b^2\right ) \sin (c+d x) \cos (c+d x)}{24 d}-\frac {3}{8} x \left (4 a^2-b^2\right )-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2735
Rule 2894
Rule 3023
Rule 3033
Rule 3049
Rule 3770
Rubi steps
\begin {align*} \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}-\frac {\int \csc (c+d x) (a+b \sin (c+d x))^2 \left (-8 b^2+5 a b \sin (c+d x)+\left (a^2+12 b^2\right ) \sin ^2(c+d x)\right ) \, dx}{4 a b}\\ &=\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}-\frac {\int \csc (c+d x) (a+b \sin (c+d x)) \left (-24 a b^2+17 a^2 b \sin (c+d x)+a \left (2 a^2+39 b^2\right ) \sin ^2(c+d x)\right ) \, dx}{12 a b}\\ &=\frac {\left (2 a^2+39 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}-\frac {\int \csc (c+d x) \left (-48 a^2 b^2+9 a b \left (4 a^2-b^2\right ) \sin (c+d x)+4 a^2 \left (a^2+28 b^2\right ) \sin ^2(c+d x)\right ) \, dx}{24 a b}\\ &=\frac {a \left (a^2+28 b^2\right ) \cos (c+d x)}{6 b d}+\frac {\left (2 a^2+39 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}-\frac {\int \csc (c+d x) \left (-48 a^2 b^2+9 a b \left (4 a^2-b^2\right ) \sin (c+d x)\right ) \, dx}{24 a b}\\ &=-\frac {3}{8} \left (4 a^2-b^2\right ) x+\frac {a \left (a^2+28 b^2\right ) \cos (c+d x)}{6 b d}+\frac {\left (2 a^2+39 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}+(2 a b) \int \csc (c+d x) \, dx\\ &=-\frac {3}{8} \left (4 a^2-b^2\right ) x-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {a \left (a^2+28 b^2\right ) \cos (c+d x)}{6 b d}+\frac {\left (2 a^2+39 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {\left (a^2+12 b^2\right ) \cos (c+d x) (a+b \sin (c+d x))^2}{12 a b d}-\frac {\cos (c+d x) (a+b \sin (c+d x))^3}{4 b d}-\frac {\cot (c+d x) (a+b \sin (c+d x))^3}{a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.70, size = 167, normalized size = 0.92 \[ -\frac {3 a^2 (c+d x)}{2 d}-\frac {a^2 \sin (2 (c+d x))}{4 d}-\frac {a^2 \cot (c+d x)}{d}+\frac {5 a b \cos (c+d x)}{2 d}+\frac {a b \cos (3 (c+d x))}{6 d}+\frac {2 a b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {2 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {3 b^2 (c+d x)}{8 d}+\frac {b^2 \sin (2 (c+d x))}{4 d}+\frac {b^2 \sin (4 (c+d x))}{32 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.80, size = 155, normalized size = 0.86 \[ -\frac {6 \, b^{2} \cos \left (d x + c\right )^{5} - 3 \, {\left (4 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{3} + 24 \, a b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 24 \, a b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 9 \, {\left (4 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right ) - {\left (16 \, a b \cos \left (d x + c\right )^{3} - 9 \, {\left (4 \, a^{2} - b^{2}\right )} d x + 48 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d \sin \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.22, size = 274, normalized size = 1.51 \[ \frac {48 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 9 \, {\left (4 \, a^{2} - b^{2}\right )} {\left (d x + c\right )} - \frac {12 \, {\left (4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} + \frac {2 \, {\left (12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 15 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 96 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} + 12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 9 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 192 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 9 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 160 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 15 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 64 \, a b\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{4}}}{24 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.54, size = 191, normalized size = 1.06 \[ -\frac {a^{2} \left (\cos ^{5}\left (d x +c \right )\right )}{d \sin \left (d x +c \right )}-\frac {a^{2} \left (\cos ^{3}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{d}-\frac {3 a^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{2 d}-\frac {3 a^{2} x}{2}-\frac {3 a^{2} c}{2 d}+\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 a b \cos \left (d x +c \right )}{d}+\frac {2 a b \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}+\frac {b^{2} \left (\cos ^{3}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{4 d}+\frac {3 b^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{8 d}+\frac {3 b^{2} x}{8}+\frac {3 b^{2} c}{8 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.49, size = 127, normalized size = 0.70 \[ -\frac {48 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} + 2}{\tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} a^{2} - 32 \, {\left (2 \, \cos \left (d x + c\right )^{3} + 6 \, \cos \left (d x + c\right ) - 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} a b - 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{96 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 9.54, size = 578, normalized size = 3.19 \[ \frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8\,\left (a^2-\frac {5\,b^2}{2}\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (6\,a^2-\frac {5\,b^2}{2}\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (8\,a^2+\frac {3\,b^2}{2}\right )-a^2-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,\left (2\,a^2-\frac {3\,b^2}{2}\right )+\frac {80\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{3}+32\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+16\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\frac {32\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3}}{d\,\left (2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9+8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+12\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}+\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}-\frac {\mathrm {atan}\left (\frac {\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )\,\left (\frac {3\,b^2}{4}-3\,a^2+6\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )+4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,1{}\mathrm {i}-\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )\,\left (3\,a^2-\frac {3\,b^2}{4}+6\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )-4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,1{}\mathrm {i}}{\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )\,\left (\frac {3\,b^2}{4}-3\,a^2+6\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )+4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )+\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )\,\left (3\,a^2-\frac {3\,b^2}{4}+6\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2\,3{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{8}\right )-4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )+3\,a\,b^3-12\,a^3\,b+2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (9\,a^4-\frac {9\,a^2\,b^2}{2}+\frac {9\,b^4}{16}\right )}\right )\,\left (3\,a^2-\frac {3\,b^2}{4}\right )}{d}+\frac {2\,a\,b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________