Optimal. Leaf size=70 \[ -\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{b^2 d}+\frac {a x}{b^2}+\frac {\cos (c+d x)}{b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 70, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {2695, 2735, 2660, 618, 204} \[ -\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{b^2 d}+\frac {a x}{b^2}+\frac {\cos (c+d x)}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 204
Rule 618
Rule 2660
Rule 2695
Rule 2735
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x)}{a+b \sin (c+d x)} \, dx &=\frac {\cos (c+d x)}{b d}+\frac {\int \frac {b+a \sin (c+d x)}{a+b \sin (c+d x)} \, dx}{b}\\ &=\frac {a x}{b^2}+\frac {\cos (c+d x)}{b d}-\frac {\left (a^2-b^2\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{b^2}\\ &=\frac {a x}{b^2}+\frac {\cos (c+d x)}{b d}-\frac {\left (2 \left (a^2-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 )}{b^2 d}\\ &=\frac {a x}{b^2}+\frac {\cos (c+d x)}{b d}+\frac {\left (4 \left (a^2-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 )}{b^2 d}\\ &=\frac {a x}{b^2}-\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{b^2 d}+\frac {\cos (c+d x)}{b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 1.40, size = 361, normalized size = 5.16 \[ \frac {\cos (c+d x) \left (2 (a-b) \sqrt {1-\sin (c+d x)} \tanh ^{-1}\left (\frac {\sqrt {a-b} \sqrt {-\frac {b (\sin (c+d x)+1)}{a-b}}}{\sqrt {a+b} \sqrt {-\frac {b (\sin (c+d x)-1)}{a+b}}}\right )+\sqrt {a+b} \left (\sqrt {-\frac {b (\sin (c+d x)-1)}{a+b}} \left (\sqrt {a-b} \sqrt {1-\sin (c+d x)} \sqrt {\frac {b (\sin (c+d x)+1)}{b-a}}+2 \sqrt {b} \sinh ^{-1}\left (\frac {\sqrt {a-b} \sqrt {-\frac {b (\sin (c+d x)+1)}{a-b}}}{\sqrt {2} \sqrt {b}}\right )\right )-2 \sqrt {a-b} \sqrt {1-\sin (c+d x)} \tanh ^{-1}\left (\frac {\sqrt {\frac {b (\sin (c+d x)+1)}{b-a}}}{\sqrt {-\frac {b (\sin (c+d x)-1)}{a+b}}}\right )\right )\right )}{b d \sqrt {a-b} \sqrt {a+b} \sqrt {1-\sin (c+d x)} \sqrt {-\frac {b (\sin (c+d x)-1)}{a+b}} \sqrt {-\frac {b (\sin (c+d x)+1)}{a-b}}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.50, size = 214, normalized size = 3.06 \[ \left [\frac {2 \, a d x + 2 \, b \cos \left (d x + c\right ) + \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right )}{2 \, b^{2} d}, \frac {a d x + b \cos \left (d x + c\right ) + \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right )}{b^{2} d}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.32, size = 95, normalized size = 1.36 \[ \frac {\frac {{\left (d x + c\right )} a}{b^{2}} - \frac {2 \, {\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}}}{b^{2}} + \frac {2}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} b}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.00, size = 142, normalized size = 2.03 \[ -\frac {2 \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right ) a^{2}}{d \,b^{2} \sqrt {a^{2}-b^{2}}}+\frac {2 \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 \sqrt {a^{2}-b^{2}}}+\frac {2}{d b \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {2 a \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,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 = 3.92, size = 318, normalized size = 4.54 \[ \frac {2}{b\,d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}+\frac {2\,a\,\mathrm {atan}\left (\frac {64\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^2-\frac {64\,a^4}{b^2}}+\frac {64\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^4-64\,a^2\,b^2}\right )}{b^2\,d}+\frac {2\,\mathrm {atanh}\left (\frac {64\,a^2\,\sqrt {b^2-a^2}}{64\,a^2\,b-\frac {64\,a^4}{b}-128\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+128\,a\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {128\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{64\,a^2-\frac {64\,a^4}{b^2}-\frac {128\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{b}+128\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {64\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{64\,a^4+128\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^3\,b-64\,a^2\,b^2-128\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b^3}\right )\,\sqrt {b^2-a^2}}{b^2\,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]
________________________________________________________________________________________