Optimal. Leaf size=113 \[ \frac{2 (a A-b B) \tan ^{-1}\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))} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.106341, antiderivative size = 113, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.21, Rules used = {3155, 3124, 618, 204} \[ \frac{2 (a A-b B) \tan ^{-1}\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))} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3155
Rule 3124
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{A+B \cos (x)}{(a+b \cos (x)+c \sin (x))^2} \, dx &=\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)) \operatorname{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)) \operatorname{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) \tan ^{-1}\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*}
Mathematica [A] time = 0.287751, size = 118, normalized size = 1.04 \[ \frac{\sin (x) \left (A \left (b^2+c^2\right )-a b B\right )+c (a A-b B)}{b \left (-a^2+b^2+c^2\right ) (a+b \cos (x)+c \sin (x))}+\frac{2 (a A-b B) \tanh ^{-1}\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}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.094, size = 254, normalized size = 2.3 \begin{align*} 2\,{\frac{1}{a \left ( \tan \left ( x/2 \right ) \right ) ^{2}-b \left ( \tan \left ( x/2 \right ) \right ) ^{2}+2\,c\tan \left ( x/2 \right ) +a+b} \left ( -{\frac{ \left ( aAb-A{b}^{2}-A{c}^{2}-{a}^{2}B+abB+B{c}^{2} \right ) \tan \left ( x/2 \right ) }{{a}^{3}-{a}^{2}b-a{b}^{2}-a{c}^{2}+{b}^{3}+b{c}^{2}}}+{\frac{ \left ( aA-bB \right ) c}{{a}^{3}-{a}^{2}b-a{b}^{2}-a{c}^{2}+{b}^{3}+b{c}^{2}}} \right ) }+2\,{\frac{aA}{ \left ({a}^{2}-{b}^{2}-{c}^{2} \right ) ^{3/2}}\arctan \left ( 1/2\,{\frac{2\, \left ( a-b \right ) \tan \left ( x/2 \right ) +2\,c}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \right ) }-2\,{\frac{bB}{ \left ({a}^{2}-{b}^{2}-{c}^{2} \right ) ^{3/2}}\arctan \left ( 1/2\,{\frac{2\, \left ( a-b \right ) \tan \left ( x/2 \right ) +2\,c}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.88085, size = 2691, normalized size = 23.81 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.17346, size = 282, normalized size = 2.5 \begin{align*} -\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 )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]