Optimal. Leaf size=36 \[ -\frac {\tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 36, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 2, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3153, 212}
\begin {gather*} -\frac {\tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 3153
Rubi steps
\begin {align*} \int \frac {1}{b \cos (x)+a \sin (x)} \, dx &=-\text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,a \cos (x)-b \sin (x)\right )\\ &=-\frac {\tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.03, size = 38, normalized size = 1.06 \begin {gather*} \frac {2 \tanh ^{-1}\left (\frac {-a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Mathics [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {cought exception: maximum recursion depth exceeded} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 35, normalized size = 0.97
method | result | size |
default | \(-\frac {2 \arctanh \left (\frac {-2 b \tan \left (\frac {x}{2}\right )+2 a}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}\) | \(35\) |
risch | \(\frac {\ln \left ({\mathrm e}^{i x}+\frac {i b -a}{\sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {i b -a}{\sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}\) | \(74\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.35, size = 61, normalized size = 1.69 \begin {gather*} -\frac {\log \left (\frac {a - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{a - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 98 vs.
\(2 (32) = 64\).
time = 0.34, size = 98, normalized size = 2.72 \begin {gather*} \frac {\log \left (-\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) - {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - 2 \, b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (a \cos \left (x\right ) - b \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) - {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2}}\right )}{2 \, \sqrt {a^{2} + b^{2}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {1}{a \sin {\left (x \right )} + b \cos {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.01, size = 75, normalized size = 2.08 \begin {gather*} -\frac {2 \ln \left (\frac {\left |2 \tan \left (\frac {x}{2}\right ) b-2 a-2 \sqrt {a^{2}+b^{2}}\right |}{\left |2 \tan \left (\frac {x}{2}\right ) b-2 a+2 \sqrt {a^{2}+b^{2}}\right |}\right )}{2 \sqrt {a^{2}+b^{2}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.73, size = 31, normalized size = 0.86 \begin {gather*} -\frac {2\,\mathrm {atanh}\left (\frac {a-b\,\mathrm {tan}\left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________