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

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

Optimal result

Integrand size = 33, antiderivative size = 337 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=-\frac {3}{2} \sqrt {x+\sqrt {1+x}}+\sqrt {1+x} \sqrt {x+\sqrt {1+x}}-\frac {7}{4} \log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}\right )+8 \text {RootSum}\left [625+1000 \text {$\#$1}+300 \text {$\#$1}^2+120 \text {$\#$1}^3+470 \text {$\#$1}^4+24 \text {$\#$1}^5+12 \text {$\#$1}^6+8 \text {$\#$1}^7+\text {$\#$1}^8\&,\frac {25 \log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}+\text {$\#$1}\right ) \text {$\#$1}+20 \log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}+\text {$\#$1}\right ) \text {$\#$1}^2+14 \log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}+\text {$\#$1}\right ) \text {$\#$1}^3+4 \log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}+\text {$\#$1}\right ) \text {$\#$1}^4+\log \left (1+2 \sqrt {1+x}-2 \sqrt {x+\sqrt {1+x}}+\text {$\#$1}\right ) \text {$\#$1}^5}{125+75 \text {$\#$1}+45 \text {$\#$1}^2+235 \text {$\#$1}^3+15 \text {$\#$1}^4+9 \text {$\#$1}^5+7 \text {$\#$1}^6+\text {$\#$1}^7}\&\right ] \] Output:

Unintegrable
                                                                                    
                                                                                    
 

Mathematica [A] (verified)

Time = 0.27 (sec) , antiderivative size = 339, normalized size of antiderivative = 1.01 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\frac {1}{2} \sqrt {x+\sqrt {1+x}} \left (-3+2 \sqrt {1+x}\right )-\frac {7}{4} \log \left (-1-2 \sqrt {1+x}+2 \sqrt {x+\sqrt {1+x}}\right )+\text {RootSum}\left [1-8 \text {$\#$1}+40 \text {$\#$1}^2-48 \text {$\#$1}^3+20 \text {$\#$1}^4+8 \text {$\#$1}^5-4 \text {$\#$1}^6+\text {$\#$1}^8\&,\frac {-\log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right )+2 \log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right ) \text {$\#$1}-2 \log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right ) \text {$\#$1}^2+4 \log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right ) \text {$\#$1}^3-\log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right ) \text {$\#$1}^4+2 \log \left (-\sqrt {1+x}+\sqrt {x+\sqrt {1+x}}-\text {$\#$1}\right ) \text {$\#$1}^5}{-1+10 \text {$\#$1}-18 \text {$\#$1}^2+10 \text {$\#$1}^3+5 \text {$\#$1}^4-3 \text {$\#$1}^5+\text {$\#$1}^7}\&\right ] \] Input:

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

Output:

(Sqrt[x + Sqrt[1 + x]]*(-3 + 2*Sqrt[1 + x]))/2 - (7*Log[-1 - 2*Sqrt[1 + x] 
 + 2*Sqrt[x + Sqrt[1 + x]]])/4 + RootSum[1 - 8*#1 + 40*#1^2 - 48*#1^3 + 20 
*#1^4 + 8*#1^5 - 4*#1^6 + #1^8 & , (-Log[-Sqrt[1 + x] + Sqrt[x + Sqrt[1 + 
x]] - #1] + 2*Log[-Sqrt[1 + x] + Sqrt[x + Sqrt[1 + x]] - #1]*#1 - 2*Log[-S 
qrt[1 + x] + Sqrt[x + Sqrt[1 + x]] - #1]*#1^2 + 4*Log[-Sqrt[1 + x] + Sqrt[ 
x + Sqrt[1 + x]] - #1]*#1^3 - Log[-Sqrt[1 + x] + Sqrt[x + Sqrt[1 + x]] - # 
1]*#1^4 + 2*Log[-Sqrt[1 + x] + Sqrt[x + Sqrt[1 + x]] - #1]*#1^5)/(-1 + 10* 
#1 - 18*#1^2 + 10*#1^3 + 5*#1^4 - 3*#1^5 + #1^7) & ]
 

Rubi [C] (verified)

Result contains complex when optimal does not.

Time = 2.13 (sec) , antiderivative size = 441, normalized size of antiderivative = 1.31, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {2003, 7267, 25, 7292, 7279, 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 {\sqrt {x+1} \left (x^2-1\right )}{\left (x^2+1\right ) \sqrt {x+\sqrt {x+1}}} \, dx\)

\(\Big \downarrow \) 2003

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

\(\Big \downarrow \) 7267

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 7292

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

\(\Big \downarrow \) 7279

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

\(\Big \downarrow \) 2009

\(\displaystyle 2 \left (-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \arctan \left (\frac {-2 \left ((-2+2 i)+\sqrt {1-i}\right ) \sqrt {x+1}+4 \sqrt {1-i}+(2-2 i)}{4 \sqrt {(1+i)+(1-i)^{3/2}} \sqrt {x+\sqrt {x+1}}}\right )}{\sqrt {(1+i)+(1-i)^{3/2}}}-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \arctan \left (\frac {2 \left ((2-2 i)+\sqrt {1-i}\right ) \sqrt {x+1}-4 \sqrt {1-i}+(2-2 i)}{4 \sqrt {(1+i)-(1-i)^{3/2}} \sqrt {x+\sqrt {x+1}}}\right )}{\sqrt {(1+i)-(1-i)^{3/2}}}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \arctan \left (\frac {-2 \left ((-2-2 i)+\sqrt {1+i}\right ) \sqrt {x+1}+4 \sqrt {1+i}+(2+2 i)}{4 \sqrt {(1-i)+(1+i)^{3/2}} \sqrt {x+\sqrt {x+1}}}\right )}{\sqrt {(1-i)+(1+i)^{3/2}}}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \arctan \left (\frac {2 \left ((2+2 i)+\sqrt {1+i}\right ) \sqrt {x+1}-4 \sqrt {1+i}+(2+2 i)}{4 \sqrt {(1-i)-(1+i)^{3/2}} \sqrt {x+\sqrt {x+1}}}\right )}{\sqrt {(1-i)-(1+i)^{3/2}}}+\frac {7}{8} \text {arctanh}\left (\frac {2 \sqrt {x+1}+1}{2 \sqrt {x+\sqrt {x+1}}}\right )+\frac {1}{2} \sqrt {x+1} \sqrt {x+\sqrt {x+1}}-\frac {3}{4} \sqrt {x+\sqrt {x+1}}\right )\)

Input:

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

Output:

2*((-3*Sqrt[x + Sqrt[1 + x]])/4 + (Sqrt[1 + x]*Sqrt[x + Sqrt[1 + x]])/2 - 
((1/2 + I/2)*ArcTan[((2 - 2*I) + 4*Sqrt[1 - I] - 2*((-2 + 2*I) + Sqrt[1 - 
I])*Sqrt[1 + x])/(4*Sqrt[(1 + I) + (1 - I)^(3/2)]*Sqrt[x + Sqrt[1 + x]])]) 
/Sqrt[(1 + I) + (1 - I)^(3/2)] - ((1/2 + I/2)*ArcTan[((2 - 2*I) - 4*Sqrt[1 
 - I] + 2*((2 - 2*I) + Sqrt[1 - I])*Sqrt[1 + x])/(4*Sqrt[(1 + I) - (1 - I) 
^(3/2)]*Sqrt[x + Sqrt[1 + x]])])/Sqrt[(1 + I) - (1 - I)^(3/2)] - ((1/2 - I 
/2)*ArcTan[((2 + 2*I) + 4*Sqrt[1 + I] - 2*((-2 - 2*I) + Sqrt[1 + I])*Sqrt[ 
1 + x])/(4*Sqrt[(1 - I) + (1 + I)^(3/2)]*Sqrt[x + Sqrt[1 + x]])])/Sqrt[(1 
- I) + (1 + I)^(3/2)] - ((1/2 - I/2)*ArcTan[((2 + 2*I) - 4*Sqrt[1 + I] + 2 
*((2 + 2*I) + Sqrt[1 + I])*Sqrt[1 + x])/(4*Sqrt[(1 - I) - (1 + I)^(3/2)]*S 
qrt[x + Sqrt[1 + x]])])/Sqrt[(1 - I) - (1 + I)^(3/2)] + (7*ArcTanh[(1 + 2* 
Sqrt[1 + x])/(2*Sqrt[x + Sqrt[1 + x]])])/8)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2003
Int[(u_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] : 
> Int[u*(c + d*x)^(n + p)*(a/c + (b/d)*x)^p, x] /; FreeQ[{a, b, c, d, n, p} 
, x] && EqQ[b*c^2 + a*d^2, 0] && (IntegerQ[p] || (GtQ[a, 0] && GtQ[c, 0] && 
  !IntegerQ[n]))
 

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

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 7279
Int[(u_)/((a_.) + (b_.)*(x_)^(n_.) + (c_.)*(x_)^(n2_.)), x_Symbol] :> With[ 
{v = RationalFunctionExpand[u/(a + b*x^n + c*x^(2*n)), x]}, Int[v, x] /; Su 
mQ[v]] /; FreeQ[{a, b, c}, x] && EqQ[n2, 2*n] && IGtQ[n, 0]
 

rule 7292
Int[u_, x_Symbol] :> With[{v = NormalizeIntegrand[u, x]}, Int[v, x] /; v =! 
= u]
 
Maple [N/A] (verified)

Time = 0.16 (sec) , antiderivative size = 161, normalized size of antiderivative = 0.48

method result size
derivativedivides \(\sqrt {1+x}\, \sqrt {x +\sqrt {1+x}}-\frac {3 \sqrt {x +\sqrt {1+x}}}{2}+\frac {7 \ln \left (\frac {1}{2}+\sqrt {1+x}+\sqrt {x +\sqrt {1+x}}\right )}{4}+\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (\textit {\_Z}^{8}-4 \textit {\_Z}^{6}+8 \textit {\_Z}^{5}+20 \textit {\_Z}^{4}-48 \textit {\_Z}^{3}+40 \textit {\_Z}^{2}-8 \textit {\_Z} +1\right )}{\sum }\frac {\left (2 \textit {\_R}^{5}-\textit {\_R}^{4}+4 \textit {\_R}^{3}-2 \textit {\_R}^{2}+2 \textit {\_R} -1\right ) \ln \left (\sqrt {x +\sqrt {1+x}}-\sqrt {1+x}-\textit {\_R} \right )}{\textit {\_R}^{7}-3 \textit {\_R}^{5}+5 \textit {\_R}^{4}+10 \textit {\_R}^{3}-18 \textit {\_R}^{2}+10 \textit {\_R} -1}\right )\) \(161\)
default \(\sqrt {1+x}\, \sqrt {x +\sqrt {1+x}}-\frac {3 \sqrt {x +\sqrt {1+x}}}{2}+\frac {7 \ln \left (\frac {1}{2}+\sqrt {1+x}+\sqrt {x +\sqrt {1+x}}\right )}{4}+\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (\textit {\_Z}^{8}-4 \textit {\_Z}^{6}+8 \textit {\_Z}^{5}+20 \textit {\_Z}^{4}-48 \textit {\_Z}^{3}+40 \textit {\_Z}^{2}-8 \textit {\_Z} +1\right )}{\sum }\frac {\left (2 \textit {\_R}^{5}-\textit {\_R}^{4}+4 \textit {\_R}^{3}-2 \textit {\_R}^{2}+2 \textit {\_R} -1\right ) \ln \left (\sqrt {x +\sqrt {1+x}}-\sqrt {1+x}-\textit {\_R} \right )}{\textit {\_R}^{7}-3 \textit {\_R}^{5}+5 \textit {\_R}^{4}+10 \textit {\_R}^{3}-18 \textit {\_R}^{2}+10 \textit {\_R} -1}\right )\) \(161\)

Input:

int((1+x)^(1/2)*(x^2-1)/(x^2+1)/(x+(1+x)^(1/2))^(1/2),x,method=_RETURNVERB 
OSE)
 

Output:

(1+x)^(1/2)*(x+(1+x)^(1/2))^(1/2)-3/2*(x+(1+x)^(1/2))^(1/2)+7/4*ln(1/2+(1+ 
x)^(1/2)+(x+(1+x)^(1/2))^(1/2))+sum((2*_R^5-_R^4+4*_R^3-2*_R^2+2*_R-1)/(_R 
^7-3*_R^5+5*_R^4+10*_R^3-18*_R^2+10*_R-1)*ln((x+(1+x)^(1/2))^(1/2)-(1+x)^( 
1/2)-_R),_R=RootOf(_Z^8-4*_Z^6+8*_Z^5+20*_Z^4-48*_Z^3+40*_Z^2-8*_Z+1))
 

Fricas [C] (verification not implemented)

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

Time = 9.61 (sec) , antiderivative size = 5376, normalized size of antiderivative = 15.95 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\text {Too large to display} \] Input:

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

Output:

Too large to include
 

Sympy [N/A]

Not integrable

Time = 11.03 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.08 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\int \frac {\left (x - 1\right ) \left (x + 1\right )^{\frac {3}{2}}}{\sqrt {x + \sqrt {x + 1}} \left (x^{2} + 1\right )}\, dx \] Input:

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

Output:

Integral((x - 1)*(x + 1)**(3/2)/(sqrt(x + sqrt(x + 1))*(x**2 + 1)), x)
 

Maxima [N/A]

Not integrable

Time = 0.18 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.09 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\int { \frac {{\left (x^{2} - 1\right )} \sqrt {x + 1}}{{\left (x^{2} + 1\right )} \sqrt {x + \sqrt {x + 1}}} \,d x } \] Input:

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

Output:

integrate((x^2 - 1)*sqrt(x + 1)/((x^2 + 1)*sqrt(x + sqrt(x + 1))), x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Invalid _EXT in replace_ext Error: 
Bad Argument ValueInvalid _EXT in replace_ext Error: Bad Argument ValueInv 
alid _EXT
 

Mupad [N/A]

Not integrable

Time = 10.38 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.09 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=\int \frac {\left (x^2-1\right )\,\sqrt {x+1}}{\sqrt {x+\sqrt {x+1}}\,\left (x^2+1\right )} \,d x \] Input:

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

Output:

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

Reduce [N/A]

Not integrable

Time = 0.48 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.18 \[ \int \frac {\sqrt {1+x} \left (-1+x^2\right )}{\left (1+x^2\right ) \sqrt {x+\sqrt {1+x}}} \, dx=-\left (\int \frac {\sqrt {x +1}}{\sqrt {\sqrt {x +1}+x}\, x^{2}+\sqrt {\sqrt {x +1}+x}}d x \right )+\int \frac {\sqrt {x +1}\, x^{2}}{\sqrt {\sqrt {x +1}+x}\, x^{2}+\sqrt {\sqrt {x +1}+x}}d x \] Input:

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

Output:

 - int(sqrt(x + 1)/(sqrt(sqrt(x + 1) + x)*x**2 + sqrt(sqrt(x + 1) + x)),x) 
 + int((sqrt(x + 1)*x**2)/(sqrt(sqrt(x + 1) + x)*x**2 + sqrt(sqrt(x + 1) + 
 x)),x)