Integrand size = 26, antiderivative size = 105 \[ \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 C)) x}{2 a^2}+\frac {i \left (2 a A b-a^2 (B-i C)-b^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 = 105, 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 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 C)) x}{2 a^2}+\frac {i \left (2 a A b-a^2 (B-i C)-b^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.56 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.57 \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)+i b \sin (x)} \, dx=\frac {\left (2 a A b+a^2 (B-i C)-b^2 (B+i C)\right ) x+2 \left (-2 a A b+a^2 (B-i C)+b^2 (B+i C)\right ) \arctan \left (\frac {(a+b) \cot \left (\frac {x}{2}\right )}{a-b}\right )+2 i a b (B+i C) \cos (x)+\left (2 i a A b+a^2 (-i B-C)+b^2 (-i B+C)\right ) \log \left (a^2+b^2+2 a b \cos (x)\right )+2 a b (B+i C) \sin (x)}{4 a^2 b} \]
[In]
[Out]
Time = 1.32 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.30
method | result | size |
default | \(\frac {\left (-2 i A a +i B b -b C \right ) \ln \left (-i+\tan \left (\frac {x}{2}\right )\right )}{2 a^{2}}-\frac {-i C -B}{a \left (-i+\tan \left (\frac {x}{2}\right )\right )}+\frac {i \left (-i C +B \right ) \ln \left (\tan \left (\frac {x}{2}\right )+i\right )}{2 b}+\frac {i \left (i C \,a^{2}-i C \,b^{2}+2 A a b -B \,a^{2}-B \,b^{2}\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}\) | \(136\) |
risch | \(-\frac {C \,{\mathrm e}^{-i x}}{2 a}+\frac {i B \,{\mathrm e}^{-i x}}{2 a}-\frac {i b x C}{2 a^{2}}+\frac {x A}{a}-\frac {b x B}{2 a^{2}}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {a}{b}\right ) C}{2 b}+\frac {b \ln \left ({\mathrm e}^{i x}+\frac {a}{b}\right ) C}{2 a^{2}}+\frac {i \ln \left ({\mathrm e}^{i x}+\frac {a}{b}\right ) A}{a}-\frac {i \ln \left ({\mathrm e}^{i x}+\frac {a}{b}\right ) B}{2 b}-\frac {i b \ln \left ({\mathrm e}^{i x}+\frac {a}{b}\right ) B}{2 a^{2}}\) | \(143\) |
[In]
[Out]
none
Time = 0.24 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.85 \[ \int \frac {A+B \cos (x)+C \sin (x)}{a+b \cos (x)+i b \sin (x)} \, dx=\frac {{\left ({\left (i \, B - C\right )} a b + {\left (2 \, A a b - {\left (B + i \, C\right )} b^{2}\right )} x 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 )} e^{\left (i \, x\right )} \log \left (\frac {b e^{\left (i \, x\right )} + a}{b}\right )\right )} e^{\left (-i \, x\right )}}{2 \, a^{2} b} \]
[In]
[Out]
Time = 0.69 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.23 \[ \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 {2 A a - B b - i C b}{2 a^{2}} + \frac {2 A a + B a - B b + i C a - i C b}{2 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {x \left (2 A a - B b - i C b\right )}{2 a^{2}} - \frac {i \left (- 2 A a b + B a^{2} + B b^{2} - i C a^{2} + i C b^{2}\right ) \log {\left (\frac {a}{b} + e^{i x} \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 (83) = 166\).
Time = 0.27 (sec) , antiderivative size = 203, normalized size of antiderivative = 1.93 \[ \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.68 (sec) , antiderivative size = 132, normalized size of antiderivative = 1.26 \[ \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 {C\,b^2}{2}-\frac {B\,b^2\,1{}\mathrm {i}}{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 (C+B\,1{}\mathrm {i}\right )}{2\,b}+\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )\,\left (B\,b-2\,A\,a+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 )-\mathrm {i}\right )} \]
[In]
[Out]