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.06, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, 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 206
Rule 618
Rule 3124
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.06, 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]
________________________________________________________________________________________
fricas [A] time = 0.47, size = 287, normalized size = 6.11 \[ \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 \relax (x)^{2} - a^{2} + 2 \, {\left (a b^{2} + a\right )} \cos \relax (x) + 2 \, {\left (a b^{3} + a b - {\left (b^{3} - {\left (2 \, a^{2} - 1\right )} b\right )} \cos \relax (x)\right )} \sin \relax (x) - 2 \, {\left (2 \, a b \cos \relax (x)^{2} - a b + {\left (b^{3} + b\right )} \cos \relax (x) - {\left (b^{2} - {\left (a b^{2} - a\right )} \cos \relax (x) + 1\right )} \sin \relax (x)\right )} \sqrt {-a^{2} + b^{2} + 1} + 2}{{\left (b^{2} - 1\right )} \cos \relax (x)^{2} - a^{2} - b^{2} - 2 \, a \cos \relax (x) - 2 \, {\left (a b + b \cos \relax (x)\right )} \sin \relax (x)}\right )}{2 \, {\left (a^{2} - b^{2} - 1\right )}}, \frac {\arctan \left (-\frac {{\left (a b \sin \relax (x) + b^{2} + a \cos \relax (x) + 1\right )} \sqrt {a^{2} - b^{2} - 1}}{{\left (b^{3} - {\left (a^{2} - 1\right )} b\right )} \cos \relax (x) + {\left (a^{2} - b^{2} - 1\right )} \sin \relax (x)}\right )}{\sqrt {a^{2} - b^{2} - 1}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.19, size = 60, normalized size = 1.28 \[ \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}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.07, size = 43, normalized size = 0.91 \[ \frac {2 \arctan \left (\frac {2 b +2 \left (a -1\right ) \tan \left (\frac {x}{2}\right )}{2 \sqrt {a^{2}-b^{2}-1}}\right )}{\sqrt {a^{2}-b^{2}-1}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.26, size = 58, normalized size = 1.23 \[ \left \{\begin {array}{cl} \frac {\ln \left (b\,\mathrm {tan}\left (\frac {x}{2}\right )+1\right )}{b} & \text {\ if\ \ }a=1\\ \frac {2\,\mathrm {atan}\left (\frac {b+\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a-1\right )}{\sqrt {a^2-b^2-1}}\right )}{\sqrt {a^2-b^2-1}} & \text {\ if\ \ }a\neq 1 \end {array}\right . \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________