Optimal. Leaf size=193 \[ \frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}-\frac {2 b^2 \left (3 a^2-4 b^2\right ) \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^5 d \sqrt {a^2-b^2}}-\frac {b \left (a^2-4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{a^5 d}+\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 1.04, antiderivative size = 193, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 8, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {2889, 3056, 3055, 3001, 3770, 2660, 618, 204} \[ -\frac {2 b^2 \left (3 a^2-4 b^2\right ) \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^5 d \sqrt {a^2-b^2}}+\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}-\frac {b \left (a^2-4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{a^5 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 204
Rule 618
Rule 2660
Rule 2889
Rule 3001
Rule 3055
Rule 3056
Rule 3770
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x) \csc ^2(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=\int \frac {\csc ^4(c+d x) \left (1-\sin ^2(c+d x)\right )}{(a+b \sin (c+d x))^2} \, dx\\ &=\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc ^4(c+d x) \left (4 \left (a^2-b^2\right )-3 \left (a^2-b^2\right ) \sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx}{a \left (a^2-b^2\right )}\\ &=-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc ^3(c+d x) \left (-12 b \left (a^2-b^2\right )-a \left (a^2-b^2\right ) \sin (c+d x)+8 b \left (a^2-b^2\right ) \sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx}{3 a^2 \left (a^2-b^2\right )}\\ &=\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc ^2(c+d x) \left (-2 \left (a^4-13 a^2 b^2+12 b^4\right )+4 a b \left (a^2-b^2\right ) \sin (c+d x)-12 b^2 \left (a^2-b^2\right ) \sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx}{6 a^3 \left (a^2-b^2\right )}\\ &=\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc (c+d x) \left (6 b \left (a^4-5 a^2 b^2+4 b^4\right )-12 a b^2 \left (a^2-b^2\right ) \sin (c+d x)\right )}{a+b \sin (c+d x)} \, dx}{6 a^4 \left (a^2-b^2\right )}\\ &=\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\left (b \left (a^2-4 b^2\right )\right ) \int \csc (c+d x) \, dx}{a^5}-\frac {\left (b^2 \left (3 a^2-4 b^2\right )\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{a^5}\\ &=-\frac {b \left (a^2-4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{a^5 d}+\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}-\frac {\left (2 b^2 \left (3 a^2-4 b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^5 d}\\ &=-\frac {b \left (a^2-4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{a^5 d}+\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}+\frac {\left (4 b^2 \left (3 a^2-4 b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^5 d}\\ &=-\frac {2 b^2 \left (3 a^2-4 b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^5 \sqrt {a^2-b^2} d}-\frac {b \left (a^2-4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{a^5 d}+\frac {\left (a^2-12 b^2\right ) \cot (c+d x)}{3 a^4 d}+\frac {2 b \cot (c+d x) \csc (c+d x)}{a^3 d}-\frac {4 \cot (c+d x) \csc ^2(c+d x)}{3 a^2 d}+\frac {\cot (c+d x) \csc ^2(c+d x)}{a d (a+b \sin (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 6.34, size = 385, normalized size = 1.99 \[ -\frac {b^3 \cos (c+d x)}{a^4 d (a+b \sin (c+d x))}+\frac {b \csc ^2\left (\frac {1}{2} (c+d x)\right )}{4 a^3 d}-\frac {b \sec ^2\left (\frac {1}{2} (c+d x)\right )}{4 a^3 d}-\frac {\cot \left (\frac {1}{2} (c+d x)\right ) \csc ^2\left (\frac {1}{2} (c+d x)\right )}{24 a^2 d}+\frac {\tan \left (\frac {1}{2} (c+d x)\right ) \sec ^2\left (\frac {1}{2} (c+d x)\right )}{24 a^2 d}+\frac {\left (a^2 b-4 b^3\right ) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a^5 d}+\frac {\left (4 b^3-a^2 b\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{a^5 d}-\frac {2 b^2 \left (3 a^2-4 b^2\right ) \tan ^{-1}\left (\frac {\sec \left (\frac {1}{2} (c+d x)\right ) \left (a \sin \left (\frac {1}{2} (c+d x)\right )+b \cos \left (\frac {1}{2} (c+d x)\right )\right )}{\sqrt {a^2-b^2}}\right )}{a^5 d \sqrt {a^2-b^2}}+\frac {\csc \left (\frac {1}{2} (c+d x)\right ) \left (a^2 \cos \left (\frac {1}{2} (c+d x)\right )-9 b^2 \cos \left (\frac {1}{2} (c+d x)\right )\right )}{6 a^4 d}+\frac {\sec \left (\frac {1}{2} (c+d x)\right ) \left (9 b^2 \sin \left (\frac {1}{2} (c+d x)\right )-a^2 \sin \left (\frac {1}{2} (c+d x)\right )\right )}{6 a^4 d} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.84, size = 1471, normalized size = 7.62 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.22, size = 329, normalized size = 1.70 \[ \frac {\frac {24 \, {\left (a^{2} b - 4 \, b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{5}} - \frac {48 \, {\left (3 \, a^{2} b^{2} - 4 \, b^{4}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (a) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} a^{5}} + \frac {a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 36 \, a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}} - \frac {48 \, {\left (b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a b^{3}\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a\right )} a^{5}} - \frac {44 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 176 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 36 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 6 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{3}}{a^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.82, size = 390, normalized size = 2.02 \[ \frac {\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )}{24 d \,a^{2}}-\frac {\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b}{4 d \,a^{3}}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{8 d \,a^{2}}+\frac {3 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{4}}-\frac {1}{24 a^{2} d \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}+\frac {1}{8 d \,a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {3 b^{2}}{2 d \,a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {b}{4 d \,a^{3} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,a^{3}}-\frac {4 b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,a^{5}}-\frac {2 b^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \,a^{5} \left (\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a +2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b +a \right )}-\frac {2 b^{3}}{d \,a^{4} \left (\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a +2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b +a \right )}-\frac {6 \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right ) b^{2}}{d \,a^{3} \sqrt {a^{2}-b^{2}}}+\frac {8 b^{4} \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{d \,a^{5} \sqrt {a^{2}-b^{2}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 9.99, size = 1089, normalized size = 5.64 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cos ^{2}{\left (c + d x \right )} \csc ^{4}{\left (c + d x \right )}}{\left (a + b \sin {\left (c + d x \right )}\right )^{2}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________