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.24, antiderivative size = 100, normalized size of antiderivative = 1.00, 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 204
Rule 618
Rule 2660
Rule 2695
Rule 2735
Rule 4401
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.18, 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]
________________________________________________________________________________________
fricas [A] time = 0.78, size = 262, normalized size = 2.62 \[ \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 \relax (x)^{2} - 2 \, c d \sin \relax (x) - c^{2} - d^{2} + 2 \, {\left (c \cos \relax (x) \sin \relax (x) + d \cos \relax (x)\right )} \sqrt {-c^{2} + d^{2}}}{d^{2} \cos \relax (x)^{2} - 2 \, c d \sin \relax (x) - 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 \relax (x)}{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 \relax (x) + d}{\sqrt {c^{2} - d^{2}} \cos \relax (x)}\right ) + {\left (b c^{3} - b c d^{2}\right )} x + {\left (b c^{2} d - b d^{3}\right )} \cos \relax (x)}{c^{2} d^{2} - d^{4}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.15, size = 93, normalized size = 0.93 \[ \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}\relax (c) + \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} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.08, size = 153, normalized size = 1.53 \[ \frac {2 \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right ) a}{\sqrt {c^{2}-d^{2}}}-\frac {2 \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right ) c^{2} b}{d^{2} \sqrt {c^{2}-d^{2}}}+\frac {2 \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right ) b}{\sqrt {c^{2}-d^{2}}}+\frac {2 b}{d \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )}+\frac {2 b c \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{d^{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 = 5.15, size = 1646, normalized size = 16.46 \[ \text {result too large to display} \]
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]
________________________________________________________________________________________