Optimal. Leaf size=84 \[ -\frac {x}{2}+\frac {\tan ^{-1}\left (\frac {1-\tan (x)}{\sqrt {2} \sqrt {\tan (x)}}\right )}{\sqrt {2}}+\frac {\tanh ^{-1}\left (\frac {1+\tan (x)}{\sqrt {2} \sqrt {\tan (x)}}\right )}{\sqrt {2}}+\frac {1}{2} \log (\cos (x))+\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 133, normalized size of antiderivative = 1.58, number of steps
used = 19, number of rules used = 13, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {3751, 6857,
1845, 303, 1176, 631, 210, 1179, 642, 1262, 649, 209, 266} \begin {gather*} -\frac {x}{2}+\frac {\tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (x)}\right )}{\sqrt {2}}-\frac {\tan ^{-1}\left (\sqrt {2} \sqrt {\tan (x)}+1\right )}{\sqrt {2}}+\frac {1}{1-\sqrt {\tan (x)}}+\log \left (1-\sqrt {\tan (x)}\right )-\frac {\log \left (\tan (x)-\sqrt {2} \sqrt {\tan (x)}+1\right )}{2 \sqrt {2}}+\frac {\log \left (\tan (x)+\sqrt {2} \sqrt {\tan (x)}+1\right )}{2 \sqrt {2}}+\frac {1}{2} \log (\cos (x)) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 210
Rule 266
Rule 303
Rule 631
Rule 642
Rule 649
Rule 1176
Rule 1179
Rule 1262
Rule 1845
Rule 3751
Rule 6857
Rubi steps
\begin {align*} \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx &=\text {Subst}\left (\int \frac {x}{\left (-1+\sqrt {x}\right )^2 \left (1+x^2\right )} \, dx,x,\tan (x)\right )\\ &=2 \text {Subst}\left (\int \frac {x^3}{(-1+x)^2 \left (1+x^4\right )} \, dx,x,\sqrt {\tan (x)}\right )\\ &=2 \text {Subst}\left (\int \left (\frac {1}{2 (-1+x)^2}+\frac {1}{2 (-1+x)}-\frac {x (1+x)^2}{2 \left (1+x^4\right )}\right ) \, dx,x,\sqrt {\tan (x)}\right )\\ &=\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\text {Subst}\left (\int \frac {x (1+x)^2}{1+x^4} \, dx,x,\sqrt {\tan (x)}\right )\\ &=\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\text {Subst}\left (\int \left (\frac {2 x^2}{1+x^4}+\frac {x \left (1+x^2\right )}{1+x^4}\right ) \, dx,x,\sqrt {\tan (x)}\right )\\ &=\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-2 \text {Subst}\left (\int \frac {x^2}{1+x^4} \, dx,x,\sqrt {\tan (x)}\right )-\text {Subst}\left (\int \frac {x \left (1+x^2\right )}{1+x^4} \, dx,x,\sqrt {\tan (x)}\right )\\ &=\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\frac {1}{2} \text {Subst}\left (\int \frac {1+x}{1+x^2} \, dx,x,\tan (x)\right )+\text {Subst}\left (\int \frac {1-x^2}{1+x^4} \, dx,x,\sqrt {\tan (x)}\right )-\text {Subst}\left (\int \frac {1+x^2}{1+x^4} \, dx,x,\sqrt {\tan (x)}\right )\\ &=\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\frac {1}{2} \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (x)\right )-\frac {1}{2} \text {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\tan (x)\right )-\frac {1}{2} \text {Subst}\left (\int \frac {1}{1-\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (x)}\right )-\frac {1}{2} \text {Subst}\left (\int \frac {1}{1+\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (x)}\right )-\frac {\text {Subst}\left (\int \frac {\sqrt {2}+2 x}{-1-\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (x)}\right )}{2 \sqrt {2}}-\frac {\text {Subst}\left (\int \frac {\sqrt {2}-2 x}{-1+\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (x)}\right )}{2 \sqrt {2}}\\ &=-\frac {x}{2}+\frac {1}{2} \log (\cos (x))+\log \left (1-\sqrt {\tan (x)}\right )-\frac {\log \left (1-\sqrt {2} \sqrt {\tan (x)}+\tan (x)\right )}{2 \sqrt {2}}+\frac {\log \left (1+\sqrt {2} \sqrt {\tan (x)}+\tan (x)\right )}{2 \sqrt {2}}+\frac {1}{1-\sqrt {\tan (x)}}-\frac {\text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1-\sqrt {2} \sqrt {\tan (x)}\right )}{\sqrt {2}}+\frac {\text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1+\sqrt {2} \sqrt {\tan (x)}\right )}{\sqrt {2}}\\ &=-\frac {x}{2}+\frac {\tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (x)}\right )}{\sqrt {2}}-\frac {\tan ^{-1}\left (1+\sqrt {2} \sqrt {\tan (x)}\right )}{\sqrt {2}}+\frac {1}{2} \log (\cos (x))+\log \left (1-\sqrt {\tan (x)}\right )-\frac {\log \left (1-\sqrt {2} \sqrt {\tan (x)}+\tan (x)\right )}{2 \sqrt {2}}+\frac {\log \left (1+\sqrt {2} \sqrt {\tan (x)}+\tan (x)\right )}{2 \sqrt {2}}+\frac {1}{1-\sqrt {\tan (x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in
optimal.
time = 0.18, size = 62, normalized size = 0.74 \begin {gather*} -\frac {1}{2} \tan ^{-1}(\tan (x))+\frac {1}{2} \log (\cos (x))+\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\frac {2}{3} \, _2F_1\left (\frac {3}{4},1;\frac {7}{4};-\tan ^2(x)\right ) \tan ^{\frac {3}{2}}(x) \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 while calling a Python object} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.05, size = 94, normalized size = 1.12
method | result | size |
derivativedivides | \(-\frac {1}{-1+\sqrt {\tan }\left (x \right )}+\ln \left (-1+\sqrt {\tan }\left (x \right )\right )-\frac {\arctan \left (\tan \left (x \right )\right )}{2}-\frac {\sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )+\tan \left (x \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )+\tan \left (x \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )\right )\right )}{4}-\frac {\ln \left (1+\tan ^{2}\left (x \right )\right )}{4}\) | \(94\) |
default | \(-\frac {1}{-1+\sqrt {\tan }\left (x \right )}+\ln \left (-1+\sqrt {\tan }\left (x \right )\right )-\frac {\arctan \left (\tan \left (x \right )\right )}{2}-\frac {\sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )+\tan \left (x \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )+\tan \left (x \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (x \right )\right )\right )\right )}{4}-\frac {\ln \left (1+\tan ^{2}\left (x \right )\right )}{4}\) | \(94\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.36, size = 117, normalized size = 1.39 \begin {gather*} \frac {1}{4} \, \sqrt {2} {\left (\sqrt {2} - 2\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, \sqrt {\tan \left (x\right )}\right )}\right ) - \frac {1}{4} \, \sqrt {2} {\left (\sqrt {2} + 2\right )} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, \sqrt {\tan \left (x\right )}\right )}\right ) - \frac {1}{8} \, \sqrt {2} {\left (\sqrt {2} - 2\right )} \log \left (\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) - \frac {1}{8} \, \sqrt {2} {\left (\sqrt {2} + 2\right )} \log \left (-\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) - \frac {1}{\sqrt {\tan \left (x\right )} - 1} + \log \left (\sqrt {\tan \left (x\right )} - 1\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [C] Result contains complex when optimal does not.
time = 1.25, size = 603, normalized size = 7.18
result too large to display
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 {\tan {\left (x \right )}}{\left (\sqrt {\tan {\left (x \right )}} - 1\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.01, size = 155, normalized size = 1.85 \begin {gather*} -\frac {1}{4} \sqrt {2} \ln \left (\tan x-\sqrt {2} \sqrt {\tan x}+1\right )+\frac {1}{2} \left (-\sqrt {2}-1\right ) \arctan \left (\frac {2 \left (\sqrt {\tan x}-\frac {\sqrt {2}}{2}\right )}{\sqrt {2}}\right )+\frac {1}{4} \sqrt {2} \ln \left (\tan x+\sqrt {2} \sqrt {\tan x}+1\right )+\frac {1}{2} \left (-\sqrt {2}+1\right ) \arctan \left (\frac {2 \left (\sqrt {\tan x}+\frac {\sqrt {2}}{2}\right )}{\sqrt {2}}\right )-\frac {\ln \left (\tan ^{2}x+1\right )}{4}+\ln \left |\sqrt {\tan x}-1\right |-\frac 1{\sqrt {\tan x}-1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.27, size = 228, normalized size = 2.71 \begin {gather*} \ln \left (612\,\sqrt {\mathrm {tan}\left (x\right )}-612\right )-\frac {1}{\sqrt {\mathrm {tan}\left (x\right )}-1}+\left (\sum _{k=1}^4\ln \left (4\,\sqrt {\mathrm {tan}\left (x\right )}+{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^2\,\sqrt {\mathrm {tan}\left (x\right )}\,80+{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^3\,\sqrt {\mathrm {tan}\left (x\right )}\,448+{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^4\,\sqrt {\mathrm {tan}\left (x\right )}\,128+32\,{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^2-384\,{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^3-256\,{\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )}^4-\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )\,\sqrt {\mathrm {tan}\left (x\right )}\,48-4\right )\,\mathrm {root}\left (z^4+z^3+\frac {z^2}{2}-\frac {z}{8}+\frac {1}{64},z,k\right )\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________