Optimal. Leaf size=48 \[ \frac {a \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}}-\frac {\tanh ^{-1}(\cos (x))}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.08, antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3110, 3770, 3074, 206} \[ \frac {a \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}}-\frac {\tanh ^{-1}(\cos (x))}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 3074
Rule 3110
Rule 3770
Rubi steps
\begin {align*} \int \frac {\cot (x)}{b \cos (x)+a \sin (x)} \, dx &=\int \left (\frac {\csc (x)}{b}-\frac {a}{b (b \cos (x)+a \sin (x))}\right ) \, dx\\ &=\frac {\int \csc (x) \, dx}{b}-\frac {a \int \frac {1}{b \cos (x)+a \sin (x)} \, dx}{b}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}+\frac {a \operatorname {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,a \cos (x)-b \sin (x)\right )}{b}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}+\frac {a \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.08, size = 60, normalized size = 1.25 \[ \frac {-\frac {2 a \tanh ^{-1}\left (\frac {b \tan \left (\frac {x}{2}\right )-a}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}+\log \left (\sin \left (\frac {x}{2}\right )\right )-\log \left (\cos \left (\frac {x}{2}\right )\right )}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.47, size = 142, normalized size = 2.96 \[ \frac {\sqrt {a^{2} + b^{2}} a \log \left (\frac {2 \, a b \cos \relax (x) \sin \relax (x) - {\left (a^{2} - b^{2}\right )} \cos \relax (x)^{2} - a^{2} - 2 \, b^{2} - 2 \, \sqrt {a^{2} + b^{2}} {\left (a \cos \relax (x) - b \sin \relax (x)\right )}}{2 \, a b \cos \relax (x) \sin \relax (x) - {\left (a^{2} - b^{2}\right )} \cos \relax (x)^{2} + a^{2}}\right ) - {\left (a^{2} + b^{2}\right )} \log \left (\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) + {\left (a^{2} + b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right )}{2 \, {\left (a^{2} b + b^{3}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.21, size = 75, normalized size = 1.56 \[ \frac {a \log \left (\frac {{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}} b} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.10, size = 49, normalized size = 1.02 \[ -\frac {2 a \arctanh \left (\frac {2 b \tan \left (\frac {x}{2}\right )-2 a}{2 \sqrt {a^{2}+b^{2}}}\right )}{b \sqrt {a^{2}+b^{2}}}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.46, size = 79, normalized size = 1.65 \[ \frac {a \log \left (\frac {a - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} + \sqrt {a^{2} + b^{2}}}{a - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}} b} + \frac {\log \left (\frac {\sin \relax (x)}{\cos \relax (x) + 1}\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.98, size = 123, normalized size = 2.56 \[ \frac {\ln \left (\frac {\sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )}\right )}{b}-\frac {2\,a\,\mathrm {atanh}\left (\frac {\sqrt {a^2+b^2}\,\left (4{}\mathrm {i}\,\sin \left (\frac {x}{2}\right )\,a^2+2{}\mathrm {i}\,\cos \left (\frac {x}{2}\right )\,a\,b+1{}\mathrm {i}\,\sin \left (\frac {x}{2}\right )\,b^2\right )}{a^3\,\sin \left (\frac {x}{2}\right )\,4{}\mathrm {i}+a^2\,b\,\cos \left (\frac {x}{2}\right )\,1{}\mathrm {i}+a\,b^2\,\sin \left (\frac {x}{2}\right )\,3{}\mathrm {i}+b\,\cos \left (\frac {x}{2}\right )\,\left (a^2+b^2\right )\,1{}\mathrm {i}}\right )}{b\,\sqrt {a^2+b^2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cot {\relax (x )}}{a \sin {\relax (x )} + b \cos {\relax (x )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________