Integrand size = 15, antiderivative size = 52 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=-\frac {x}{2 b}+\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a-b} \tan (x)}{\sqrt {a+b}}\right )}{2 \sqrt {a-b} b} \]
[Out]
Time = 0.15 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {1144, 211} \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a-b} \tan (x)}{\sqrt {a+b}}\right )}{2 b \sqrt {a-b}}-\frac {x}{2 b} \]
[In]
[Out]
Rule 211
Rule 1144
Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {x^2}{a+b+2 a x^2+(a-b) x^4} \, dx,x,\tan (x)\right ) \\ & = -\left (\frac {1}{2} \left (-1+\frac {a}{b}\right ) \text {Subst}\left (\int \frac {1}{a-b+(a-b) x^2} \, dx,x,\tan (x)\right )\right )+\frac {(a+b) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan (x)\right )}{2 b} \\ & = -\frac {x}{2 b}+\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a-b} \tan (x)}{\sqrt {a+b}}\right )}{2 \sqrt {a-b} b} \\ \end{align*}
Time = 0.12 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.92 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=-\frac {x+\frac {(a+b) \text {arctanh}\left (\frac {(a-b) \tan (x)}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}}{2 b} \]
[In]
[Out]
Time = 2.23 (sec) , antiderivative size = 49, normalized size of antiderivative = 0.94
method | result | size |
default | \(-\frac {\arctan \left (\tan \left (x \right )\right )}{2 b}+\frac {\left (a +b \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (x \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{2 b \sqrt {\left (a +b \right ) \left (a -b \right )}}\) | \(49\) |
risch | \(-\frac {x}{2 b}-\frac {\sqrt {-\left (a +b \right ) \left (a -b \right )}\, \ln \left ({\mathrm e}^{2 i x}+\frac {i \sqrt {-\left (a +b \right ) \left (a -b \right )}+a}{b}\right )}{4 \left (a -b \right ) b}+\frac {\sqrt {-\left (a +b \right ) \left (a -b \right )}\, \ln \left ({\mathrm e}^{2 i x}-\frac {i \sqrt {-\left (a +b \right ) \left (a -b \right )}-a}{b}\right )}{4 \left (a -b \right ) b}\) | \(115\) |
[In]
[Out]
none
Time = 0.29 (sec) , antiderivative size = 225, normalized size of antiderivative = 4.33 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\left [\frac {\sqrt {-\frac {a + b}{a - b}} \log \left (\frac {4 \, {\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{4} - 4 \, {\left (2 \, a^{2} - a b - b^{2}\right )} \cos \left (x\right )^{2} - 4 \, {\left (2 \, {\left (a^{2} - a b\right )} \cos \left (x\right )^{3} - {\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (x\right )\right )} \sqrt {-\frac {a + b}{a - b}} \sin \left (x\right ) + a^{2} - 2 \, a b + b^{2}}{4 \, b^{2} \cos \left (x\right )^{4} + 4 \, {\left (a b - b^{2}\right )} \cos \left (x\right )^{2} + a^{2} - 2 \, a b + b^{2}}\right ) - 4 \, x}{8 \, b}, -\frac {\sqrt {\frac {a + b}{a - b}} \arctan \left (\frac {{\left (2 \, a \cos \left (x\right )^{2} - a + b\right )} \sqrt {\frac {a + b}{a - b}}}{2 \, {\left (a + b\right )} \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, x}{4 \, b}\right ] \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 284 vs. \(2 (39) = 78\).
Time = 16.32 (sec) , antiderivative size = 432, normalized size of antiderivative = 8.31 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\begin {cases} \tilde {\infty } \left (- \frac {\log {\left (\tan {\left (x \right )} - 1 \right )}}{2} + \frac {\log {\left (\tan {\left (x \right )} + 1 \right )}}{2}\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {\tan {\left (x \right )}}{4 b} & \text {for}\: a = b \\\frac {1}{4 b \tan {\left (x \right )}} & \text {for}\: a = - b \\\frac {\log {\left (- \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (x \right )} \right )}}{4 a \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {\log {\left (\sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (x \right )} \right )}}{4 a \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} & \text {otherwise} \end {cases} - \begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \\\frac {x}{2 b} - \frac {\tan {\left (x \right )}}{4 b} & \text {for}\: a = b \\\frac {x}{2 b} + \frac {1}{4 b \tan {\left (x \right )}} & \text {for}\: a = - b \\\frac {\sin {\left (2 x \right )}}{4 a} & \text {for}\: b = 0 \\\frac {2 a x \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}}{4 a b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b^{2} \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {a \log {\left (- \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (x \right )} \right )}}{4 a b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b^{2} \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} + \frac {a \log {\left (\sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (x \right )} \right )}}{4 a b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b^{2} \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {2 b x \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}}{4 a b \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - 4 b^{2} \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} & \text {otherwise} \end {cases} \]
[In]
[Out]
Exception generated. \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 141 vs. \(2 (40) = 80\).
Time = 0.29 (sec) , antiderivative size = 141, normalized size of antiderivative = 2.71 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\frac {\sqrt {a^{2} - b^{2}} {\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \tan \left (x\right )}{\sqrt {\frac {4 \, a + \sqrt {-16 \, {\left (a + b\right )} {\left (a - b\right )} + 16 \, a^{2}}}{a - b}}}\right )\right )} {\left | a - b \right |}}{2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} {\left | b \right |}} - \frac {\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \tan \left (x\right )}{\sqrt {\frac {4 \, a - \sqrt {-16 \, {\left (a + b\right )} {\left (a - b\right )} + 16 \, a^{2}}}{a - b}}}\right )}{2 \, {\left | b \right |}} \]
[In]
[Out]
Time = 26.85 (sec) , antiderivative size = 108, normalized size of antiderivative = 2.08 \[ \int \frac {\sin ^2(x)}{a+b \cos (2 x)} \, dx=\frac {\mathrm {atan}\left (\frac {2\,b^3\,\mathrm {tan}\left (x\right )}{2\,a^2\,b-2\,b^3}-\frac {2\,a^2\,b\,\mathrm {tan}\left (x\right )}{2\,a^2\,b-2\,b^3}\right )}{2\,b}+\frac {\mathrm {atanh}\left (\frac {a\,\mathrm {tan}\left (x\right )}{\sqrt {b^2-a^2}}-\frac {b\,\mathrm {tan}\left (x\right )}{\sqrt {b^2-a^2}}\right )\,\sqrt {b^2-a^2}}{2\,\left (a\,b-b^2\right )} \]
[In]
[Out]