Optimal. Leaf size=100 \[ \frac{2 a \tan ^{-1}\left (\frac{c \tan \left (\frac{x}{2}\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}-\frac{2 b \sqrt{c^2-d^2} \tan ^{-1}\left (\frac{c \tan \left (\frac{x}{2}\right )+d}{\sqrt{c^2-d^2}}\right )}{d^2}+\frac{b c x}{d^2}+\frac{b \cos (x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.240105, antiderivative size = 100, normalized size of antiderivative = 1., number of steps used = 10, number of rules used = 6, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.353, Rules used = {4401, 2660, 618, 204, 2695, 2735} \[ \frac{2 a \tan ^{-1}\left (\frac{c \tan \left (\frac{x}{2}\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}-\frac{2 b \sqrt{c^2-d^2} \tan ^{-1}\left (\frac{c \tan \left (\frac{x}{2}\right )+d}{\sqrt{c^2-d^2}}\right )}{d^2}+\frac{b c x}{d^2}+\frac{b \cos (x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4401
Rule 2660
Rule 618
Rule 204
Rule 2695
Rule 2735
Rubi steps
\begin{align*} \int \frac{a+b \cos ^2(x)}{c+d \sin (x)} \, dx &=\int \left (\frac{a}{c+d \sin (x)}+\frac{b \cos ^2(x)}{c+d \sin (x)}\right ) \, dx\\ &=a \int \frac{1}{c+d \sin (x)} \, dx+b \int \frac{\cos ^2(x)}{c+d \sin (x)} \, dx\\ &=\frac{b \cos (x)}{d}+(2 a) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )+\frac{b \int \frac{d+c \sin (x)}{c+d \sin (x)} \, dx}{d}\\ &=\frac{b c x}{d^2}+\frac{b \cos (x)}{d}-(4 a) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{x}{2}\right )\right )-\frac{\left (b \left (c^2-d^2\right )\right ) \int \frac{1}{c+d \sin (x)} \, dx}{d^2}\\ &=\frac{b c x}{d^2}+\frac{2 a \tan ^{-1}\left (\frac{d+c \tan \left (\frac{x}{2}\right )}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}+\frac{b \cos (x)}{d}-\frac{\left (2 b \left (c^2-d^2\right )\right ) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{d^2}\\ &=\frac{b c x}{d^2}+\frac{2 a \tan ^{-1}\left (\frac{d+c \tan \left (\frac{x}{2}\right )}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}+\frac{b \cos (x)}{d}+\frac{\left (4 b \left (c^2-d^2\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{x}{2}\right )\right )}{d^2}\\ &=\frac{b c x}{d^2}+\frac{2 a \tan ^{-1}\left (\frac{d+c \tan \left (\frac{x}{2}\right )}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}-\frac{2 b \sqrt{c^2-d^2} \tan ^{-1}\left (\frac{d+c \tan \left (\frac{x}{2}\right )}{\sqrt{c^2-d^2}}\right )}{d^2}+\frac{b \cos (x)}{d}\\ \end{align*}
Mathematica [A] time = 0.189639, size = 72, normalized size = 0.72 \[ \frac{\frac{2 \left (a d^2+b \left (d^2-c^2\right )\right ) \tan ^{-1}\left (\frac{c \tan \left (\frac{x}{2}\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}+b (c x+d \cos (x))}{d^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.033, size = 153, normalized size = 1.5 \begin{align*} 2\,{\frac{a}{\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( x/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }-2\,{\frac{{c}^{2}b}{{d}^{2}\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( x/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }+2\,{\frac{b}{\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( x/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }+2\,{\frac{b}{d \left ( 1+ \left ( \tan \left ( x/2 \right ) \right ) ^{2} \right ) }}+2\,{\frac{cb\arctan \left ( \tan \left ( x/2 \right ) \right ) }{{d}^{2}}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.63432, size = 571, normalized size = 5.71 \begin{align*} \left [\frac{{\left (b c^{2} -{\left (a + b\right )} d^{2}\right )} \sqrt{-c^{2} + d^{2}} \log \left (\frac{{\left (2 \, c^{2} - d^{2}\right )} \cos \left (x\right )^{2} - 2 \, c d \sin \left (x\right ) - c^{2} - d^{2} + 2 \,{\left (c \cos \left (x\right ) \sin \left (x\right ) + d \cos \left (x\right )\right )} \sqrt{-c^{2} + d^{2}}}{d^{2} \cos \left (x\right )^{2} - 2 \, c d \sin \left (x\right ) - c^{2} - d^{2}}\right ) + 2 \,{\left (b c^{3} - b c d^{2}\right )} x + 2 \,{\left (b c^{2} d - b d^{3}\right )} \cos \left (x\right )}{2 \,{\left (c^{2} d^{2} - d^{4}\right )}}, \frac{{\left (b c^{2} -{\left (a + b\right )} d^{2}\right )} \sqrt{c^{2} - d^{2}} \arctan \left (-\frac{c \sin \left (x\right ) + d}{\sqrt{c^{2} - d^{2}} \cos \left (x\right )}\right ) +{\left (b c^{3} - b c d^{2}\right )} x +{\left (b c^{2} d - b d^{3}\right )} \cos \left (x\right )}{c^{2} d^{2} - d^{4}}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.16553, size = 126, normalized size = 1.26 \begin{align*} \frac{b c x}{d^{2}} - \frac{2 \,{\left (b c^{2} - a d^{2} - b d^{2}\right )}{\left (\pi \left \lfloor \frac{x}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (c\right ) + \arctan \left (\frac{c \tan \left (\frac{1}{2} \, x\right ) + d}{\sqrt{c^{2} - d^{2}}}\right )\right )}}{\sqrt{c^{2} - d^{2}} d^{2}} + \frac{2 \, b}{{\left (\tan \left (\frac{1}{2} \, x\right )^{2} + 1\right )} d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]