Optimal. Leaf size=49 \[ -B \tan ^{-1}\left (\frac {B \cos (x)}{\sqrt {A^2+B^2 \sin ^2(x)}}\right )-A \tanh ^{-1}\left (\frac {A \cos (x)}{\sqrt {A^2+B^2 \sin ^2(x)}}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 57, normalized size of antiderivative = 1.16, number of steps
used = 6, number of rules used = 6, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3265, 399, 223,
209, 385, 212} \begin {gather*} -B \tan ^{-1}\left (\frac {B \cos (x)}{\sqrt {A^2-B^2 \cos ^2(x)+B^2}}\right )-A \tanh ^{-1}\left (\frac {A \cos (x)}{\sqrt {A^2-B^2 \cos ^2(x)+B^2}}\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 212
Rule 223
Rule 385
Rule 399
Rule 3265
Rubi steps
\begin {align*} \int \csc (x) \sqrt {A^2+B^2 \sin ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {\sqrt {A^2+B^2-B^2 x^2}}{1-x^2} \, dx,x,\cos (x)\right )\\ &=-\left (A^2 \text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \sqrt {A^2+B^2-B^2 x^2}} \, dx,x,\cos (x)\right )\right )-B^2 \text {Subst}\left (\int \frac {1}{\sqrt {A^2+B^2-B^2 x^2}} \, dx,x,\cos (x)\right )\\ &=-\left (A^2 \text {Subst}\left (\int \frac {1}{1-A^2 x^2} \, dx,x,\frac {\cos (x)}{\sqrt {A^2+B^2-B^2 \cos ^2(x)}}\right )\right )-B^2 \text {Subst}\left (\int \frac {1}{1+B^2 x^2} \, dx,x,\frac {\cos (x)}{\sqrt {A^2+B^2-B^2 \cos ^2(x)}}\right )\\ &=-B \tan ^{-1}\left (\frac {B \cos (x)}{\sqrt {A^2+B^2-B^2 \cos ^2(x)}}\right )-A \tanh ^{-1}\left (\frac {A \cos (x)}{\sqrt {A^2+B^2-B^2 \cos ^2(x)}}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(99\) vs. \(2(49)=98\).
time = 0.07, size = 99, normalized size = 2.02 \begin {gather*} -\sqrt {A^2} \tanh ^{-1}\left (\frac {\sqrt {2} \sqrt {A^2} \cos (x)}{\sqrt {2 A^2+B^2-B^2 \cos (2 x)}}\right )+\sqrt {-B^2} \log \left (\sqrt {2} \sqrt {-B^2} \cos (x)+\sqrt {2 A^2+B^2-B^2 \cos (2 x)}\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Mathics [F(-1)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains higher order function than in optimal. Order 9 vs. order
3.
time = 0.17, size = 149, normalized size = 3.04
method | result | size |
default | \(-\frac {\sqrt {\left (A^{2}+B^{2} \left (\sin ^{2}\left (x \right )\right )\right ) \left (\cos ^{2}\left (x \right )\right )}\, \left (A \,\mathrm {csgn}\left (A \right ) \ln \left (-\frac {A^{2} \left (\sin ^{2}\left (x \right )\right )-B^{2} \left (\sin ^{2}\left (x \right )\right )-2 \,\mathrm {csgn}\left (A \right ) A \sqrt {\left (A^{2}+B^{2} \left (\sin ^{2}\left (x \right )\right )\right ) \left (\cos ^{2}\left (x \right )\right )}-2 A^{2}}{\sin \left (x \right )^{2}}\right )-B \,\mathrm {csgn}\left (B \right ) \arctan \left (\frac {\mathrm {csgn}\left (B \right ) \left (2 B^{2} \left (\sin ^{2}\left (x \right )\right )+A^{2}-B^{2}\right )}{2 B \sqrt {\left (A^{2}+B^{2} \left (\sin ^{2}\left (x \right )\right )\right ) \left (\cos ^{2}\left (x \right )\right )}}\right )\right )}{2 \cos \left (x \right ) \sqrt {A^{2}+B^{2} \left (\sin ^{2}\left (x \right )\right )}}\) | \(149\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 116 vs.
\(2 (45) = 90\).
time = 0.37, size = 116, normalized size = 2.37 \begin {gather*} -B \arcsin \left (\frac {B^{2} \cos \left (x\right )}{\sqrt {A^{2} B^{2} + B^{4}}}\right ) - \frac {1}{2} \, A \log \left (B^{2} - \frac {A^{2}}{\cos \left (x\right ) - 1} - \frac {\sqrt {-B^{2} \cos \left (x\right )^{2} + A^{2} + B^{2}} A}{\cos \left (x\right ) - 1}\right ) + \frac {1}{2} \, A \log \left (-B^{2} + \frac {A^{2}}{\cos \left (x\right ) + 1} + \frac {\sqrt {-B^{2} \cos \left (x\right )^{2} + A^{2} + B^{2}} A}{\cos \left (x\right ) + 1}\right ) \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. 244 vs.
\(2 (45) = 90\).
time = 0.39, size = 244, normalized size = 4.98 \begin {gather*} \frac {1}{2} \, B \arctan \left (-\frac {{\left (A^{4} + 2 \, A^{2} B^{2} + B^{4}\right )} \cos \left (x\right ) \sin \left (x\right ) - 2 \, {\left (2 \, B^{3} \cos \left (x\right )^{3} - {\left (A^{2} B + B^{3}\right )} \cos \left (x\right )\right )} \sqrt {-B^{2} \cos \left (x\right )^{2} + A^{2} + B^{2}}}{4 \, B^{4} \cos \left (x\right )^{4} + A^{4} + 2 \, A^{2} B^{2} + B^{4} - {\left (A^{4} + 6 \, A^{2} B^{2} + 5 \, B^{4}\right )} \cos \left (x\right )^{2}}\right ) - \frac {1}{2} \, B \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right ) - \frac {1}{2} \, A \log \left (-B^{2} \cos \left (x\right )^{2} + A B \cos \left (x\right ) \sin \left (x\right ) + A^{2} + B^{2} + \sqrt {-B^{2} \cos \left (x\right )^{2} + A^{2} + B^{2}} {\left (A \cos \left (x\right ) + B \sin \left (x\right )\right )}\right ) + \frac {1}{2} \, A \log \left (-B^{2} \cos \left (x\right )^{2} - A B \cos \left (x\right ) \sin \left (x\right ) + A^{2} + B^{2} - \sqrt {-B^{2} \cos \left (x\right )^{2} + A^{2} + B^{2}} {\left (A \cos \left (x\right ) - B \sin \left (x\right )\right )}\right ) \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 {\sqrt {A^{2} + B^{2} \sin ^{2}{\left (x \right )}}}{\sin {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] N/A
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {\sqrt {A^2+B^2\,{\sin \left (x\right )}^2}}{\sin \left (x\right )} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________