Optimal. Leaf size=37 \[ -\frac{x}{2}+\frac{1}{2} \log (\cos (x)-\sin (x))+\frac{\tanh ^{-1}\left (\frac{\cos (x) (\tan (x)+1)}{\sqrt{2}}\right )}{\sqrt{2}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0895854, antiderivative size = 37, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.385, Rules used = {4401, 3484, 3530, 3509, 206} \[ -\frac{x}{2}+\frac{1}{2} \log (\cos (x)-\sin (x))+\frac{\tanh ^{-1}\left (\frac{\cos (x) (\tan (x)+1)}{\sqrt{2}}\right )}{\sqrt{2}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4401
Rule 3484
Rule 3530
Rule 3509
Rule 206
Rubi steps
\begin{align*} \int \frac{-1+\sec (x)}{1-\tan (x)} \, dx &=\int \left (\frac{1}{-1+\tan (x)}-\frac{\sec (x)}{-1+\tan (x)}\right ) \, dx\\ &=\int \frac{1}{-1+\tan (x)} \, dx-\int \frac{\sec (x)}{-1+\tan (x)} \, dx\\ &=-\frac{x}{2}+\frac{1}{2} \int \frac{1+\tan (x)}{-1+\tan (x)} \, dx+\operatorname{Subst}\left (\int \frac{1}{2-x^2} \, dx,x,\cos (x) (1+\tan (x))\right )\\ &=-\frac{x}{2}+\frac{\tanh ^{-1}\left (\frac{\cos (x) (1+\tan (x))}{\sqrt{2}}\right )}{\sqrt{2}}+\frac{1}{2} \log (\cos (x)-\sin (x))\\ \end{align*}
Mathematica [C] time = 0.0602444, size = 40, normalized size = 1.08 \[ \frac{1}{2} \left (-x+(2-2 i) \sqrt [4]{-1} \tanh ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right )+1}{\sqrt{2}}\right )+\log (\cos (x)-\sin (x))\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.045, size = 51, normalized size = 1.4 \begin{align*}{\frac{1}{2}\ln \left ( \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{2}+2\,\tan \left ( x/2 \right ) -1 \right ) }+\sqrt{2}{\it Artanh} \left ({\frac{\sqrt{2}}{4} \left ( 2+2\,\tan \left ( x/2 \right ) \right ) } \right ) -{\frac{1}{2}\ln \left ( 1+ \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{2} \right ) }-{\frac{x}{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.45566, size = 80, normalized size = 2.16 \begin{align*} -\frac{1}{2} \, \sqrt{2} \log \left (-\frac{\sqrt{2} - \frac{\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1}{\sqrt{2} + \frac{\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1}\right ) - \frac{1}{2} \, x - \frac{1}{4} \, \log \left (\tan \left (x\right )^{2} + 1\right ) + \frac{1}{2} \, \log \left (\tan \left (x\right ) - 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.20353, size = 180, normalized size = 4.86 \begin{align*} \frac{1}{4} \, \sqrt{2} \log \left (\frac{2 \,{\left (\sqrt{2} + \cos \left (x\right )\right )} \sin \left (x\right ) + 2 \, \sqrt{2} \cos \left (x\right ) + 3}{2 \, \cos \left (x\right ) \sin \left (x\right ) - 1}\right ) - \frac{1}{2} \, x + \frac{1}{4} \, \log \left (-2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} - \int \frac{\sec{\left (x \right )}}{\tan{\left (x \right )} - 1}\, dx - \int - \frac{1}{\tan{\left (x \right )} - 1}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.16572, size = 95, normalized size = 2.57 \begin{align*} -\frac{1}{2} \, \sqrt{2} \log \left (\frac{{\left | -2 \, \sqrt{2} + 2 \, \tan \left (\frac{1}{2} \, x\right ) + 2 \right |}}{{\left | 2 \, \sqrt{2} + 2 \, \tan \left (\frac{1}{2} \, x\right ) + 2 \right |}}\right ) - \frac{1}{2} \, x - \frac{1}{2} \, \log \left (\tan \left (\frac{1}{2} \, x\right )^{2} + 1\right ) + \frac{1}{2} \, \log \left ({\left | \tan \left (\frac{1}{2} \, x\right )^{2} + 2 \, \tan \left (\frac{1}{2} \, x\right ) - 1 \right |}\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]