Integrand size = 25, antiderivative size = 90 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=-\frac {b (B-i C) x}{2 a^2}+\frac {\left (i a^2 (B+i C)+b^2 (i B+C)\right ) \log (a+b \cos (x)-i b \sin (x))}{2 a^2 b}-\frac {(i B+C) (\cos (x)+i \sin (x))}{2 a} \]
[Out]
Time = 0.09 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.94, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.040, Rules used = {3209} \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=-\frac {b x (B-i C)}{2 a^2}+\frac {1}{2} \left (\frac {b (C+i B)}{a^2}+\frac {i (B+i C)}{b}\right ) \log (a-i b \sin (x)+b \cos (x))-\frac {(C+i B) (\cos (x)+i \sin (x))}{2 a} \]
[In]
[Out]
Rule 3209
Rubi steps \begin{align*} \text {integral}& = -\frac {b (B-i C) x}{2 a^2}+\frac {1}{2} \left (\frac {i (B+i C)}{b}+\frac {b (i B+C)}{a^2}\right ) \log (a+b \cos (x)-i b \sin (x))-\frac {(i B+C) (\cos (x)+i \sin (x))}{2 a} \\ \end{align*}
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(195\) vs. \(2(90)=180\).
Time = 0.56 (sec) , antiderivative size = 195, normalized size of antiderivative = 2.17 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\frac {\left (a^2 B-b^2 B+i a^2 C+i b^2 C\right ) x}{4 a^2 b}+\frac {\left (a^2 B+b^2 B+i a^2 C-i b^2 C\right ) \arctan \left (\frac {(a+b) \cos \left (\frac {x}{2}\right )}{a \sin \left (\frac {x}{2}\right )-b \sin \left (\frac {x}{2}\right )}\right )}{2 a^2 b}-\frac {i (B-i C) \cos (x)}{2 a}+\frac {i \left (a^2 B+b^2 B+i a^2 C-i b^2 C\right ) \log \left (a^2+b^2+2 a b \cos (x)\right )}{4 a^2 b}+\frac {(B-i C) \sin (x)}{2 a} \]
[In]
[Out]
Time = 1.25 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.29
method | result | size |
risch | \(-\frac {C \,{\mathrm e}^{i x}}{2 a}-\frac {i B \,{\mathrm e}^{i x}}{2 a}+\frac {i x C}{2 b}+\frac {B x}{2 b}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {b}{a}\right ) C}{2 b}+\frac {b \ln \left ({\mathrm e}^{i x}+\frac {b}{a}\right ) C}{2 a^{2}}+\frac {i \ln \left ({\mathrm e}^{i x}+\frac {b}{a}\right ) B}{2 b}+\frac {i b \ln \left ({\mathrm e}^{i x}+\frac {b}{a}\right ) B}{2 a^{2}}\) | \(116\) |
default | \(-\frac {i \left (i C +B \right ) \ln \left (-i+\tan \left (\frac {x}{2}\right )\right )}{2 b}-\frac {i \left (i C \,a^{2}-i C \,b^{2}+B \,a^{2}+B \,b^{2}\right ) \left (a -b \right ) \ln \left (i a +i b -a \tan \left (\frac {x}{2}\right )+b \tan \left (\frac {x}{2}\right )\right )}{2 a^{2} b \left (-a +b \right )}-\frac {i C -B}{a \left (\tan \left (\frac {x}{2}\right )+i\right )}-\frac {b \left (i B +C \right ) \ln \left (\tan \left (\frac {x}{2}\right )+i\right )}{2 a^{2}}\) | \(133\) |
[In]
[Out]
none
Time = 0.26 (sec) , antiderivative size = 68, normalized size of antiderivative = 0.76 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\frac {{\left (B + i \, C\right )} a^{2} x + {\left (-i \, B - C\right )} a b e^{\left (i \, x\right )} + {\left ({\left (i \, B - C\right )} a^{2} + {\left (i \, B + C\right )} b^{2}\right )} \log \left (\frac {a e^{\left (i \, x\right )} + b}{a}\right )}{2 \, a^{2} b} \]
[In]
[Out]
Time = 0.42 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.10 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\begin {cases} \frac {\left (- i B - C\right ) e^{i x}}{2 a} & \text {for}\: a \neq 0 \\x \left (- \frac {B + i C}{2 b} + \frac {B a + B b + i C a - i C b}{2 a b}\right ) & \text {otherwise} \end {cases} + \frac {x \left (B + i C\right )}{2 b} + \frac {i \left (B a^{2} + B b^{2} + i C a^{2} - i C b^{2}\right ) \log {\left (e^{i x} + \frac {b}{a} \right )}}{2 a^{2} b} \]
[In]
[Out]
Exception generated. \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\text {Exception raised: RuntimeError} \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 178 vs. \(2 (73) = 146\).
Time = 0.27 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.98 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=-\frac {{\left (-i \, B b - C b\right )} \log \left (-a \tan \left (\frac {1}{2} \, x\right )^{2} + b \tan \left (\frac {1}{2} \, x\right )^{2} + 2 i \, a \tan \left (\frac {1}{2} \, x\right ) + a + b\right )}{4 \, a^{2}} - \frac {{\left (i \, B b + C b\right )} \log \left (\tan \left (\frac {1}{2} \, x\right ) + i\right )}{2 \, a^{2}} + \frac {{\left (2 \, B a^{2} + 2 i \, C a^{2} + B b^{2} - i \, C b^{2}\right )} {\left (x + 2 \, \arctan \left (\frac {i \, a \cos \left (x\right ) - a \sin \left (x\right ) + i \, a}{a \cos \left (x\right ) + i \, a \sin \left (x\right ) - a + 2 \, b}\right )\right )}}{4 \, a^{2} b} - \frac {-i \, B b \tan \left (\frac {1}{2} \, x\right ) - C b \tan \left (\frac {1}{2} \, x\right ) - 2 \, B a + 2 i \, C a + B b - i \, C b}{2 \, a^{2} {\left (\tan \left (\frac {1}{2} \, x\right ) + i\right )}} \]
[In]
[Out]
Time = 28.00 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.31 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\ln \left (a+b+a\,\mathrm {tan}\left (\frac {x}{2}\right )\,1{}\mathrm {i}-b\,\mathrm {tan}\left (\frac {x}{2}\right )\,1{}\mathrm {i}\right )\,\left (\frac {-\frac {C}{2}+\frac {B\,1{}\mathrm {i}}{2}}{b}+\frac {\frac {C\,b^2}{2}+\frac {B\,b^2\,1{}\mathrm {i}}{2}}{a^2\,b}\right )+\frac {B-C\,1{}\mathrm {i}}{a\,\left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )\,\left (C\,b+B\,b\,1{}\mathrm {i}\right )}{2\,a^2}-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,b} \]
[In]
[Out]