\(\int \frac {\tan (x)}{(-1+\sqrt {\tan (x)})^2} \, dx\) [401]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [A] (verification not implemented)
Giac [A] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [F]

Optimal result

Integrand size = 13, antiderivative size = 84 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=-\frac {x}{2}+\frac {\arctan \left (\frac {1-\tan (x)}{\sqrt {2} \sqrt {\tan (x)}}\right )}{\sqrt {2}}+\frac {\text {arctanh}\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)}} \] Output:

-1/2*x+1/2*ln(cos(x))+ln(1-tan(x)^(1/2))+1/2*arctan(1/2*(1-tan(x))*2^(1/2) 
/tan(x)^(1/2))*2^(1/2)+1/2*arctanh(1/2*(1+tan(x))*2^(1/2)/tan(x)^(1/2))*2^ 
(1/2)+1/(1-tan(x)^(1/2))
 

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.20 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.74 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=-\frac {1}{2} \arctan (\tan (x))+\frac {1}{2} \log (\cos (x))+\log \left (1-\sqrt {\tan (x)}\right )+\frac {1}{1-\sqrt {\tan (x)}}-\frac {2}{3} \operatorname {Hypergeometric2F1}\left (\frac {3}{4},1,\frac {7}{4},-\tan ^2(x)\right ) \tan ^{\frac {3}{2}}(x) \] Input:

Integrate[Tan[x]/(-1 + Sqrt[Tan[x]])^2,x]
 

Output:

-1/2*ArcTan[Tan[x]] + Log[Cos[x]]/2 + Log[1 - Sqrt[Tan[x]]] + (1 - Sqrt[Ta 
n[x]])^(-1) - (2*Hypergeometric2F1[3/4, 1, 7/4, -Tan[x]^2]*Tan[x]^(3/2))/3
 

Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 154, normalized size of antiderivative = 1.83, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {3042, 4153, 7267, 7276, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\tan (x)}{\left (\sqrt {\tan (x)}-1\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (x)}{\left (\sqrt {\tan (x)}-1\right )^2}dx\)

\(\Big \downarrow \) 4153

\(\displaystyle \int \frac {\tan (x)}{\left (1-\sqrt {\tan (x)}\right )^2 \left (\tan ^2(x)+1\right )}d\tan (x)\)

\(\Big \downarrow \) 7267

\(\displaystyle 2 \int \frac {\tan ^{\frac {3}{2}}(x)}{\left (1-\sqrt {\tan (x)}\right )^2 \left (\tan ^2(x)+1\right )}d\sqrt {\tan (x)}\)

\(\Big \downarrow \) 7276

\(\displaystyle 2 \int \left (-\frac {\sqrt {\tan (x)} \left (\sqrt {\tan (x)}+1\right )^2}{2 \left (\tan ^2(x)+1\right )}+\frac {1}{2 \left (\sqrt {\tan (x)}-1\right )}+\frac {1}{2 \left (\sqrt {\tan (x)}-1\right )^2}\right )d\sqrt {\tan (x)}\)

\(\Big \downarrow \) 2009

\(\displaystyle 2 \left (\frac {\arctan \left (1-\sqrt {2} \sqrt {\tan (x)}\right )}{2 \sqrt {2}}-\frac {\arctan \left (\sqrt {2} \sqrt {\tan (x)}+1\right )}{2 \sqrt {2}}-\frac {1}{4} \arctan (\tan (x))+\frac {1}{2 \left (1-\sqrt {\tan (x)}\right )}-\frac {1}{8} \log \left (\tan ^2(x)+1\right )+\frac {1}{2} \log \left (1-\sqrt {\tan (x)}\right )-\frac {\log \left (\tan (x)-\sqrt {2} \sqrt {\tan (x)}+1\right )}{4 \sqrt {2}}+\frac {\log \left (\tan (x)+\sqrt {2} \sqrt {\tan (x)}+1\right )}{4 \sqrt {2}}\right )\)

Input:

Int[Tan[x]/(-1 + Sqrt[Tan[x]])^2,x]
 

Output:

2*(ArcTan[1 - Sqrt[2]*Sqrt[Tan[x]]]/(2*Sqrt[2]) - ArcTan[1 + Sqrt[2]*Sqrt[ 
Tan[x]]]/(2*Sqrt[2]) - ArcTan[Tan[x]]/4 + Log[1 - Sqrt[Tan[x]]]/2 - Log[1 
- Sqrt[2]*Sqrt[Tan[x]] + Tan[x]]/(4*Sqrt[2]) + Log[1 + Sqrt[2]*Sqrt[Tan[x] 
] + Tan[x]]/(4*Sqrt[2]) - Log[1 + Tan[x]^2]/8 + 1/(2*(1 - Sqrt[Tan[x]])))
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4153
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], 
 x]}, Simp[c*(ff/f)   Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f 
f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, 
n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio 
nalQ[n]))
 

rule 7267
Int[u_, x_Symbol] :> With[{lst = SubstForFractionalPowerOfLinear[u, x]}, Si 
mp[lst[[2]]*lst[[4]]   Subst[Int[lst[[1]], x], x, lst[[3]]^(1/lst[[2]])], x 
] /;  !FalseQ[lst] && SubstForFractionalPowerQ[u, lst[[3]], x]]
 

rule 7276
Int[(u_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{v = RationalFunctionE 
xpand[u/(a + b*x^n), x]}, Int[v, x] /; SumQ[v]] /; FreeQ[{a, b}, x] && IGtQ 
[n, 0]
 
Maple [A] (verified)

Time = 0.13 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.12

method result size
derivativedivides \(-\frac {\arctan \left (\tan \left (x \right )\right )}{2}-\frac {\sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \sqrt {\tan \left (x \right )}+\tan \left (x \right )}{1+\sqrt {2}\, \sqrt {\tan \left (x \right )}+\tan \left (x \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \sqrt {\tan \left (x \right )}\right )+2 \arctan \left (-1+\sqrt {2}\, \sqrt {\tan \left (x \right )}\right )\right )}{4}-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{4}-\frac {1}{-1+\sqrt {\tan \left (x \right )}}+\ln \left (-1+\sqrt {\tan \left (x \right )}\right )\) \(94\)
default \(-\frac {\arctan \left (\tan \left (x \right )\right )}{2}-\frac {\sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \sqrt {\tan \left (x \right )}+\tan \left (x \right )}{1+\sqrt {2}\, \sqrt {\tan \left (x \right )}+\tan \left (x \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \sqrt {\tan \left (x \right )}\right )+2 \arctan \left (-1+\sqrt {2}\, \sqrt {\tan \left (x \right )}\right )\right )}{4}-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{4}-\frac {1}{-1+\sqrt {\tan \left (x \right )}}+\ln \left (-1+\sqrt {\tan \left (x \right )}\right )\) \(94\)

Input:

int(tan(x)/(-1+tan(x)^(1/2))^2,x,method=_RETURNVERBOSE)
 

Output:

-1/2*arctan(tan(x))-1/4*2^(1/2)*(ln((1-2^(1/2)*tan(x)^(1/2)+tan(x))/(1+2^( 
1/2)*tan(x)^(1/2)+tan(x)))+2*arctan(1+2^(1/2)*tan(x)^(1/2))+2*arctan(-1+2^ 
(1/2)*tan(x)^(1/2)))-1/4*ln(1+tan(x)^2)-1/(-1+tan(x)^(1/2))+ln(-1+tan(x)^( 
1/2))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 145 vs. \(2 (66) = 132\).

Time = 0.08 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.73 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=-\frac {2 \, {\left ({\left (\sqrt {2} - 1\right )} \tan \left (x\right ) - \sqrt {2} + 1\right )} \arctan \left (\sqrt {2} \sqrt {\tan \left (x\right )} + 1\right ) + 2 \, {\left ({\left (\sqrt {2} + 1\right )} \tan \left (x\right ) - \sqrt {2} - 1\right )} \arctan \left (\sqrt {2} \sqrt {\tan \left (x\right )} - 1\right ) - {\left ({\left (\sqrt {2} - 1\right )} \tan \left (x\right ) - \sqrt {2} + 1\right )} \log \left (\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) + {\left ({\left (\sqrt {2} + 1\right )} \tan \left (x\right ) - \sqrt {2} - 1\right )} \log \left (-\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) - 4 \, {\left (\tan \left (x\right ) - 1\right )} \log \left (\sqrt {\tan \left (x\right )} - 1\right ) + 4 \, \sqrt {\tan \left (x\right )} + 4}{4 \, {\left (\tan \left (x\right ) - 1\right )}} \] Input:

integrate(tan(x)/(-1+tan(x)^(1/2))^2,x, algorithm="fricas")
 

Output:

-1/4*(2*((sqrt(2) - 1)*tan(x) - sqrt(2) + 1)*arctan(sqrt(2)*sqrt(tan(x)) + 
 1) + 2*((sqrt(2) + 1)*tan(x) - sqrt(2) - 1)*arctan(sqrt(2)*sqrt(tan(x)) - 
 1) - ((sqrt(2) - 1)*tan(x) - sqrt(2) + 1)*log(sqrt(2)*sqrt(tan(x)) + tan( 
x) + 1) + ((sqrt(2) + 1)*tan(x) - sqrt(2) - 1)*log(-sqrt(2)*sqrt(tan(x)) + 
 tan(x) + 1) - 4*(tan(x) - 1)*log(sqrt(tan(x)) - 1) + 4*sqrt(tan(x)) + 4)/ 
(tan(x) - 1)
 

Sympy [F]

\[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=\int \frac {\tan {\left (x \right )}}{\left (\sqrt {\tan {\left (x \right )}} - 1\right )^{2}}\, dx \] Input:

integrate(tan(x)/(-1+tan(x)**(1/2))**2,x)
 

Output:

Integral(tan(x)/(sqrt(tan(x)) - 1)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.39 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=\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 ) \] Input:

integrate(tan(x)/(-1+tan(x)^(1/2))^2,x, algorithm="maxima")
 

Output:

1/4*sqrt(2)*(sqrt(2) - 2)*arctan(1/2*sqrt(2)*(sqrt(2) + 2*sqrt(tan(x)))) - 
 1/4*sqrt(2)*(sqrt(2) + 2)*arctan(-1/2*sqrt(2)*(sqrt(2) - 2*sqrt(tan(x)))) 
 - 1/8*sqrt(2)*(sqrt(2) - 2)*log(sqrt(2)*sqrt(tan(x)) + tan(x) + 1) - 1/8* 
sqrt(2)*(sqrt(2) + 2)*log(-sqrt(2)*sqrt(tan(x)) + tan(x) + 1) - 1/(sqrt(ta 
n(x)) - 1) + log(sqrt(tan(x)) - 1)
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.32 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=-\frac {1}{2} \, {\left (\sqrt {2} - 1\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, \sqrt {\tan \left (x\right )}\right )}\right ) - \frac {1}{2} \, {\left (\sqrt {2} + 1\right )} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, \sqrt {\tan \left (x\right )}\right )}\right ) + \frac {1}{4} \, \sqrt {2} \log \left (\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) - \frac {1}{4} \, \sqrt {2} \log \left (-\sqrt {2} \sqrt {\tan \left (x\right )} + \tan \left (x\right ) + 1\right ) - \frac {1}{\sqrt {\tan \left (x\right )} - 1} - \frac {1}{4} \, \log \left (\tan \left (x\right )^{2} + 1\right ) + \log \left ({\left | \sqrt {\tan \left (x\right )} - 1 \right |}\right ) \] Input:

integrate(tan(x)/(-1+tan(x)^(1/2))^2,x, algorithm="giac")
 

Output:

-1/2*(sqrt(2) - 1)*arctan(1/2*sqrt(2)*(sqrt(2) + 2*sqrt(tan(x)))) - 1/2*(s 
qrt(2) + 1)*arctan(-1/2*sqrt(2)*(sqrt(2) - 2*sqrt(tan(x)))) + 1/4*sqrt(2)* 
log(sqrt(2)*sqrt(tan(x)) + tan(x) + 1) - 1/4*sqrt(2)*log(-sqrt(2)*sqrt(tan 
(x)) + tan(x) + 1) - 1/(sqrt(tan(x)) - 1) - 1/4*log(tan(x)^2 + 1) + log(ab 
s(sqrt(tan(x)) - 1))
 

Mupad [B] (verification not implemented)

Time = 0.71 (sec) , antiderivative size = 228, normalized size of antiderivative = 2.71 \[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=\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 ) \] Input:

int(tan(x)/(tan(x)^(1/2) - 1)^2,x)
 

Output:

log(612*tan(x)^(1/2) - 612) - 1/(tan(x)^(1/2) - 1) + symsum(log(4*tan(x)^( 
1/2) + 80*root(z^4 + z^3 + z^2/2 - z/8 + 1/64, z, k)^2*tan(x)^(1/2) + 448* 
root(z^4 + z^3 + z^2/2 - z/8 + 1/64, z, k)^3*tan(x)^(1/2) + 128*root(z^4 + 
 z^3 + z^2/2 - z/8 + 1/64, z, k)^4*tan(x)^(1/2) + 32*root(z^4 + z^3 + z^2/ 
2 - z/8 + 1/64, z, k)^2 - 384*root(z^4 + z^3 + z^2/2 - z/8 + 1/64, z, k)^3 
 - 256*root(z^4 + z^3 + z^2/2 - z/8 + 1/64, z, k)^4 - 48*root(z^4 + z^3 + 
z^2/2 - z/8 + 1/64, z, k)*tan(x)^(1/2) - 4)*root(z^4 + z^3 + z^2/2 - z/8 + 
 1/64, z, k), k, 1, 4)
 

Reduce [F]

\[ \int \frac {\tan (x)}{\left (-1+\sqrt {\tan (x)}\right )^2} \, dx=\frac {8 \left (\int \frac {\sqrt {\tan \left (x \right )}\, \tan \left (x \right )}{\tan \left (x \right )^{2}-2 \tan \left (x \right )+1}d x \right ) \tan \left (x \right )-8 \left (\int \frac {\sqrt {\tan \left (x \right )}\, \tan \left (x \right )}{\tan \left (x \right )^{2}-2 \tan \left (x \right )+1}d x \right )-\mathrm {log}\left (\tan \left (x \right )^{2}+1\right ) \tan \left (x \right )+\mathrm {log}\left (\tan \left (x \right )^{2}+1\right )+2 \,\mathrm {log}\left (\tan \left (x \right )-1\right ) \tan \left (x \right )-2 \,\mathrm {log}\left (\tan \left (x \right )-1\right )-2 \tan \left (x \right ) x -4 \tan \left (x \right )+2 x}{4 \tan \left (x \right )-4} \] Input:

int(tan(x)/(-1+tan(x)^(1/2))^2,x)
 

Output:

(8*int((sqrt(tan(x))*tan(x))/(tan(x)**2 - 2*tan(x) + 1),x)*tan(x) - 8*int( 
(sqrt(tan(x))*tan(x))/(tan(x)**2 - 2*tan(x) + 1),x) - log(tan(x)**2 + 1)*t 
an(x) + log(tan(x)**2 + 1) + 2*log(tan(x) - 1)*tan(x) - 2*log(tan(x) - 1) 
- 2*tan(x)*x - 4*tan(x) + 2*x)/(4*(tan(x) - 1))