Integrand size = 26, antiderivative size = 103 \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\frac {(2 a A-b B+i b C) x}{2 a^2}-\frac {i \left (2 a A b-b^2 (B-i C)-a^2 (B+i 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.08 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.038, Rules used = {3209} \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=-\frac {i \left (-\left (a^2 (B+i C)\right )+2 a A b-b^2 (B-i C)\right ) \log (a-i b \sin (x)+b \cos (x))}{2 a^2 b}+\frac {x (2 a A-b B+i b C)}{2 a^2}-\frac {(C+i B) (\cos (x)+i \sin (x))}{2 a} \]
[In]
[Out]
Rule 3209
Rubi steps \begin{align*} \text {integral}& = \frac {(2 a A-b B+i b C) x}{2 a^2}-\frac {i \left (2 a A b-b^2 (B-i C)-a^2 (B+i 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} \\ \end{align*}
Time = 0.58 (sec) , antiderivative size = 167, normalized size of antiderivative = 1.62 \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=\frac {\left (2 a A-b (B-i C)+\frac {a^2 (B+i C)}{b}\right ) x+\frac {2 \left (-2 a A b+b^2 (B-i C)+a^2 (B+i C)\right ) \arctan \left (\frac {(a+b) \cot \left (\frac {x}{2}\right )}{a-b}\right )}{b}-2 i a (B-i C) \cos (x)+\frac {\left (-2 i a A b+i a^2 (B+i C)+b^2 (i B+C)\right ) \log \left (a^2+b^2+2 a b \cos (x)\right )}{b}+2 a (B-i C) \sin (x)}{4 a^2} \]
[In]
[Out]
Time = 1.32 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.31
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 ) A}{a}+\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}}\) | \(135\) |
default | \(\frac {i \left (-i C \,a^{2}+i C \,b^{2}+2 A a b -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 \left (i C +B \right ) \ln \left (-i+\tan \left (\frac {x}{2}\right )\right )}{2 b}-\frac {i C -B}{a \left (\tan \left (\frac {x}{2}\right )+i\right )}+\frac {\left (2 i A a -i B b -b C \right ) \ln \left (\tan \left (\frac {x}{2}\right )+i\right )}{2 a^{2}}\) | \(148\) |
[In]
[Out]
none
Time = 0.24 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.71 \[ \int \frac {A+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} - 2 i \, A a b + {\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.69 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.02 \[ \int \frac {A+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 (- 2 A a b + 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 {A+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. 203 vs. \(2 (85) = 170\).
Time = 0.27 (sec) , antiderivative size = 203, normalized size of antiderivative = 1.97 \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)-i b \sin (x)} \, dx=-\frac {{\left (2 i \, A a - 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 (-2 i \, A a + 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} - 2 \, A a b + 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 {2 i \, A a \tan \left (\frac {1}{2} \, x\right ) - i \, B b \tan \left (\frac {1}{2} \, x\right ) - C b \tan \left (\frac {1}{2} \, x\right ) - 2 \, A a - 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 = 31.92 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.29 \[ \int \frac {A+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 {B\,b^2\,1{}\mathrm {i}}{2}+\frac {C\,b^2}{2}-A\,a\,b\,1{}\mathrm {i}}{a^2\,b}\right )+\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )\,\left (2\,A\,a-B\,b+C\,b\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a^2}+\frac {5\,B-C\,5{}\mathrm {i}}{5\,a\,\left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,b} \]
[In]
[Out]