Optimal. Leaf size=47 \[ -\frac{2 \tanh ^{-1}\left (\frac{b-(1-a) \tan \left (\frac{x}{2}\right )}{\sqrt{-a^2+b^2+1}}\right )}{\sqrt{-a^2+b^2+1}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0555467, antiderivative size = 47, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.3, Rules used = {3124, 618, 206} \[ -\frac{2 \tanh ^{-1}\left (\frac{b-(1-a) \tan \left (\frac{x}{2}\right )}{\sqrt{-a^2+b^2+1}}\right )}{\sqrt{-a^2+b^2+1}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3124
Rule 618
Rule 206
Rubi steps
\begin{align*} \int \frac{1}{a+\cos (x)+b \sin (x)} \, dx &=2 \operatorname{Subst}\left (\int \frac{1}{1+a+2 b x+(-1+a) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )\\ &=-\left (4 \operatorname{Subst}\left (\int \frac{1}{4 \left (1-a^2+b^2\right )-x^2} \, dx,x,2 b+2 (-1+a) \tan \left (\frac{x}{2}\right )\right )\right )\\ &=-\frac{2 \tanh ^{-1}\left (\frac{b-(1-a) \tan \left (\frac{x}{2}\right )}{\sqrt{1-a^2+b^2}}\right )}{\sqrt{1-a^2+b^2}}\\ \end{align*}
Mathematica [A] time = 0.0603158, size = 44, normalized size = 0.94 \[ \frac{2 \tan ^{-1}\left (\frac{(a-1) \tan \left (\frac{x}{2}\right )+b}{\sqrt{a^2-b^2-1}}\right )}{\sqrt{a^2-b^2-1}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.039, size = 43, normalized size = 0.9 \begin{align*} 2\,{\frac{1}{\sqrt{{a}^{2}-{b}^{2}-1}}\arctan \left ( 1/2\,{\frac{2\, \left ( a-1 \right ) \tan \left ( x/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}-1}}} \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 [A] time = 1.97115, size = 707, normalized size = 15.04 \begin{align*} \left [-\frac{\sqrt{-a^{2} + b^{2} + 1} \log \left (-\frac{b^{4} +{\left (a^{2} + 3\right )} b^{2} -{\left (2 \, a^{2} b^{2} - b^{4} - 2 \, a^{2} + 1\right )} \cos \left (x\right )^{2} - a^{2} + 2 \,{\left (a b^{2} + a\right )} \cos \left (x\right ) + 2 \,{\left (a b^{3} + a b -{\left (b^{3} -{\left (2 \, a^{2} - 1\right )} b\right )} \cos \left (x\right )\right )} \sin \left (x\right ) - 2 \,{\left (2 \, a b \cos \left (x\right )^{2} - a b +{\left (b^{3} + b\right )} \cos \left (x\right ) -{\left (b^{2} -{\left (a b^{2} - a\right )} \cos \left (x\right ) + 1\right )} \sin \left (x\right )\right )} \sqrt{-a^{2} + b^{2} + 1} + 2}{{\left (b^{2} - 1\right )} \cos \left (x\right )^{2} - a^{2} - b^{2} - 2 \, a \cos \left (x\right ) - 2 \,{\left (a b + b \cos \left (x\right )\right )} \sin \left (x\right )}\right )}{2 \,{\left (a^{2} - b^{2} - 1\right )}}, \frac{\arctan \left (-\frac{{\left (a b \sin \left (x\right ) + b^{2} + a \cos \left (x\right ) + 1\right )} \sqrt{a^{2} - b^{2} - 1}}{{\left (b^{3} -{\left (a^{2} - 1\right )} b\right )} \cos \left (x\right ) +{\left (a^{2} - b^{2} - 1\right )} \sin \left (x\right )}\right )}{\sqrt{a^{2} - b^{2} - 1}}\right ] \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.09334, size = 81, normalized size = 1.72 \begin{align*} \frac{2 \,{\left (\pi \left \lfloor \frac{x}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (2 \, a - 2\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, x\right ) + b - \tan \left (\frac{1}{2} \, x\right )}{\sqrt{a^{2} - b^{2} - 1}}\right )\right )}}{\sqrt{a^{2} - b^{2} - 1}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]