Integrand size = 19, antiderivative size = 113 \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\frac {2 (a A-b B) \arctan \left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2-c^2}}\right )}{\left (a^2-b^2-c^2\right )^{3/2}}+\frac {B c+A c \cos (x)-(A b-a B) \sin (x)}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))} \]
[Out]
Time = 0.13 (sec) , antiderivative size = 113, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.211, Rules used = {3234, 3203, 632, 210} \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\frac {2 (a A-b B) \arctan \left (\frac {(a-b) \tan \left (\frac {x}{2}\right )+c}{\sqrt {a^2-b^2-c^2}}\right )}{\left (a^2-b^2-c^2\right )^{3/2}}+\frac {-\sin (x) (A b-a B)+A c \cos (x)+B c}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))} \]
[In]
[Out]
Rule 210
Rule 632
Rule 3203
Rule 3234
Rubi steps \begin{align*} \text {integral}& = \frac {B c+A c \cos (x)-(A b-a B) \sin (x)}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))}+\frac {(a A-b B) \int \frac {1}{a+b \cos (x)+c \sin (x)} \, dx}{a^2-b^2-c^2} \\ & = \frac {B c+A c \cos (x)-(A b-a B) \sin (x)}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))}+\frac {(2 (a A-b B)) \text {Subst}\left (\int \frac {1}{a+b+2 c x+(a-b) x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )}{a^2-b^2-c^2} \\ & = \frac {B c+A c \cos (x)-(A b-a B) \sin (x)}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))}-\frac {(4 (a A-b B)) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2-c^2\right )-x^2} \, dx,x,2 c+2 (a-b) \tan \left (\frac {x}{2}\right )\right )}{a^2-b^2-c^2} \\ & = \frac {2 (a A-b B) \arctan \left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2-c^2}}\right )}{\left (a^2-b^2-c^2\right )^{3/2}}+\frac {B c+A c \cos (x)-(A b-a B) \sin (x)}{\left (a^2-b^2-c^2\right ) (a+b \cos (x)+c \sin (x))} \\ \end{align*}
Time = 0.32 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.04 \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\frac {2 (a A-b B) \text {arctanh}\left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2+c^2}}\right )}{\left (-a^2+b^2+c^2\right )^{3/2}}+\frac {(a A-b B) c+\left (-a b B+A \left (b^2+c^2\right )\right ) \sin (x)}{b \left (-a^2+b^2+c^2\right ) (a+b \cos (x)+c \sin (x))} \]
[In]
[Out]
Time = 0.93 (sec) , antiderivative size = 206, normalized size of antiderivative = 1.82
method | result | size |
default | \(\frac {-\frac {2 \left (A a b -A \,b^{2}-A \,c^{2}-B \,a^{2}+a b B +B \,c^{2}\right ) \tan \left (\frac {x}{2}\right )}{a^{3}-a^{2} b -a \,b^{2}-a \,c^{2}+b^{3}+c^{2} b}+\frac {2 \left (A a -B b \right ) c}{a^{3}-a^{2} b -a \,b^{2}-a \,c^{2}+b^{3}+c^{2} b}}{\tan \left (\frac {x}{2}\right )^{2} a -\tan \left (\frac {x}{2}\right )^{2} b +2 c \tan \left (\frac {x}{2}\right )+a +b}+\frac {2 \left (A a -B b \right ) \arctan \left (\frac {2 \left (a -b \right ) \tan \left (\frac {x}{2}\right )+2 c}{2 \sqrt {a^{2}-b^{2}-c^{2}}}\right )}{\left (a^{2}-b^{2}-c^{2}\right )^{\frac {3}{2}}}\) | \(206\) |
risch | \(\frac {2 i \left (-i A a c \,{\mathrm e}^{i x}+i B b c \,{\mathrm e}^{i x}+A a b \,{\mathrm e}^{i x}-B \,a^{2} {\mathrm e}^{i x}+B \,c^{2} {\mathrm e}^{i x}+A \,b^{2}+A \,c^{2}-a b B \right )}{\left (-a^{2}+b^{2}+c^{2}\right ) \left (-i c +b \right ) \left (-i c \,{\mathrm e}^{2 i x}+b \,{\mathrm e}^{2 i x}+i c +2 a \,{\mathrm e}^{i x}+b \right )}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i a c \sqrt {-a^{2}+b^{2}+c^{2}}+i a^{2} b -i b^{3}-i b \,c^{2}+a b \sqrt {-a^{2}+b^{2}+c^{2}}-a^{2} c +b^{2} c +c^{3}}{\left (b^{2}+c^{2}\right ) \sqrt {-a^{2}+b^{2}+c^{2}}}\right ) A a}{\sqrt {-a^{2}+b^{2}+c^{2}}\, \left (a^{2}-b^{2}-c^{2}\right )}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i a c \sqrt {-a^{2}+b^{2}+c^{2}}+i a^{2} b -i b^{3}-i b \,c^{2}+a b \sqrt {-a^{2}+b^{2}+c^{2}}-a^{2} c +b^{2} c +c^{3}}{\left (b^{2}+c^{2}\right ) \sqrt {-a^{2}+b^{2}+c^{2}}}\right ) B b}{\sqrt {-a^{2}+b^{2}+c^{2}}\, \left (a^{2}-b^{2}-c^{2}\right )}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i a c \sqrt {-a^{2}+b^{2}+c^{2}}-i a^{2} b +i b^{3}+i b \,c^{2}+a b \sqrt {-a^{2}+b^{2}+c^{2}}+a^{2} c -b^{2} c -c^{3}}{\left (b^{2}+c^{2}\right ) \sqrt {-a^{2}+b^{2}+c^{2}}}\right ) A a}{\sqrt {-a^{2}+b^{2}+c^{2}}\, \left (a^{2}-b^{2}-c^{2}\right )}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i a c \sqrt {-a^{2}+b^{2}+c^{2}}-i a^{2} b +i b^{3}+i b \,c^{2}+a b \sqrt {-a^{2}+b^{2}+c^{2}}+a^{2} c -b^{2} c -c^{3}}{\left (b^{2}+c^{2}\right ) \sqrt {-a^{2}+b^{2}+c^{2}}}\right ) B b}{\sqrt {-a^{2}+b^{2}+c^{2}}\, \left (a^{2}-b^{2}-c^{2}\right )}\) | \(673\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 559 vs. \(2 (106) = 212\).
Time = 0.32 (sec) , antiderivative size = 1277, normalized size of antiderivative = 11.30 \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\text {Too large to display} \]
[In]
[Out]
Timed out. \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\text {Timed out} \]
[In]
[Out]
Exception generated. \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
none
Time = 0.30 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.85 \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=-\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, x\right ) - b \tan \left (\frac {1}{2} \, x\right ) + c}{\sqrt {a^{2} - b^{2} - c^{2}}}\right )\right )} {\left (A a - B b\right )}}{{\left (a^{2} - b^{2} - c^{2}\right )}^{\frac {3}{2}}} + \frac {2 \, {\left (B a^{2} \tan \left (\frac {1}{2} \, x\right ) - A a b \tan \left (\frac {1}{2} \, x\right ) - B a b \tan \left (\frac {1}{2} \, x\right ) + A b^{2} \tan \left (\frac {1}{2} \, x\right ) + A c^{2} \tan \left (\frac {1}{2} \, x\right ) - B c^{2} \tan \left (\frac {1}{2} \, x\right ) + A a c - B b c\right )}}{{\left (a^{3} - a^{2} b - a b^{2} + b^{3} - a c^{2} + b c^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, x\right )^{2} - b \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, c \tan \left (\frac {1}{2} \, x\right ) + a + b\right )}} \]
[In]
[Out]
Time = 26.22 (sec) , antiderivative size = 205, normalized size of antiderivative = 1.81 \[ \int \frac {A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx=\frac {2\,\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,a-2\,b\right )+\frac {2\,\left (-a^2\,c+b^2\,c+c^3\right )}{-a^2+b^2+c^2}}{2\,\sqrt {-a^2+b^2+c^2}}\right )\,\left (A\,a-B\,b\right )}{{\left (-a^2+b^2+c^2\right )}^{3/2}}-\frac {\frac {2\,\left (A\,a\,c-B\,b\,c\right )}{\left (a-b\right )\,\left (-a^2+b^2+c^2\right )}+\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (A\,b^2+B\,a^2+A\,c^2-B\,c^2-A\,a\,b-B\,a\,b\right )}{\left (a-b\right )\,\left (-a^2+b^2+c^2\right )}}{\left (a-b\right )\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,c\,\mathrm {tan}\left (\frac {x}{2}\right )+a+b} \]
[In]
[Out]