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

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

Optimal result

Integrand size = 31, antiderivative size = 158 \[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=-2 \sqrt {1+x+x^2}+\frac {1}{4} (1+2 x) \sqrt {1+x+x^2}-2 \sqrt {4+2 x+x^2}+\frac {1}{2} (1+x) \sqrt {4+2 x+x^2}+\frac {11}{2} \text {arcsinh}\left (\frac {1+x}{\sqrt {3}}\right )+\frac {43}{8} \text {arcsinh}\left (\frac {1+2 x}{\sqrt {3}}\right )-2 \sqrt {7} \text {arctanh}\left (\frac {1+5 x}{2 \sqrt {7} \sqrt {1+x+x^2}}\right )+2 \sqrt {7} \text {arctanh}\left (\frac {1-2 x}{\sqrt {7} \sqrt {4+2 x+x^2}}\right ) \] Output:

11/2*arcsinh(1/3*(1+x)*3^(1/2))+43/8*arcsinh(1/3*(1+2*x)*3^(1/2))-2*arctan 
h(1/14*(1+5*x)*7^(1/2)/(x^2+x+1)^(1/2))*7^(1/2)+2*arctanh(1/7*(1-2*x)*7^(1 
/2)/(x^2+2*x+4)^(1/2))*7^(1/2)-2*(x^2+x+1)^(1/2)+1/4*(1+2*x)*(x^2+x+1)^(1/ 
2)-2*(x^2+2*x+4)^(1/2)+1/2*(1+x)*(x^2+2*x+4)^(1/2)
 

Mathematica [A] (verified)

Time = 5.11 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.01 \[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\frac {1}{8} \left (-14 \sqrt {1+x+x^2}+4 x \sqrt {1+x+x^2}-12 \sqrt {4+2 x+x^2}+4 x \sqrt {4+2 x+x^2}-32 \sqrt {7} \text {arctanh}\left (\frac {3+x-\sqrt {1+x+x^2}}{\sqrt {7}}\right )-32 \sqrt {7} \text {arctanh}\left (\frac {3+x-\sqrt {4+2 x+x^2}}{\sqrt {7}}\right )-43 \log \left (-1-2 x+2 \sqrt {1+x+x^2}\right )-44 \log \left (-1-x+\sqrt {4+2 x+x^2}\right )\right ) \] Input:

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

Output:

(-14*Sqrt[1 + x + x^2] + 4*x*Sqrt[1 + x + x^2] - 12*Sqrt[4 + 2*x + x^2] + 
4*x*Sqrt[4 + 2*x + x^2] - 32*Sqrt[7]*ArcTanh[(3 + x - Sqrt[1 + x + x^2])/S 
qrt[7]] - 32*Sqrt[7]*ArcTanh[(3 + x - Sqrt[4 + 2*x + x^2])/Sqrt[7]] - 43*L 
og[-1 - 2*x + 2*Sqrt[1 + x + x^2]] - 44*Log[-1 - x + Sqrt[4 + 2*x + x^2]]) 
/8
 

Rubi [A] (verified)

Time = 0.64 (sec) , antiderivative size = 158, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.065, Rules used = {7293, 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 {x+1}{\sqrt {x^2+2 x+4}-\sqrt {x^2+x+1}} \, dx\)

\(\Big \downarrow \) 7293

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {11}{2} \text {arcsinh}\left (\frac {x+1}{\sqrt {3}}\right )+\frac {43}{8} \text {arcsinh}\left (\frac {2 x+1}{\sqrt {3}}\right )-2 \sqrt {7} \text {arctanh}\left (\frac {5 x+1}{2 \sqrt {7} \sqrt {x^2+x+1}}\right )+2 \sqrt {7} \text {arctanh}\left (\frac {1-2 x}{\sqrt {7} \sqrt {x^2+2 x+4}}\right )+\frac {1}{2} \sqrt {x^2+2 x+4} (x+1)+\frac {1}{4} (2 x+1) \sqrt {x^2+x+1}-2 \sqrt {x^2+x+1}-2 \sqrt {x^2+2 x+4}\)

Input:

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

Output:

-2*Sqrt[1 + x + x^2] + ((1 + 2*x)*Sqrt[1 + x + x^2])/4 - 2*Sqrt[4 + 2*x + 
x^2] + ((1 + x)*Sqrt[4 + 2*x + x^2])/2 + (11*ArcSinh[(1 + x)/Sqrt[3]])/2 + 
 (43*ArcSinh[(1 + 2*x)/Sqrt[3]])/8 - 2*Sqrt[7]*ArcTanh[(1 + 5*x)/(2*Sqrt[7 
]*Sqrt[1 + x + x^2])] + 2*Sqrt[7]*ArcTanh[(1 - 2*x)/(Sqrt[7]*Sqrt[4 + 2*x 
+ x^2])]
 

Defintions of rubi rules used

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

rule 7293
Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v] 
]
 
Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 140, normalized size of antiderivative = 0.89

method result size
default \(-2 \sqrt {\left (3+x \right )^{2}-5 x -8}+\frac {43 \,\operatorname {arcsinh}\left (\frac {2 \sqrt {3}\, \left (x +\frac {1}{2}\right )}{3}\right )}{8}+2 \sqrt {7}\, \operatorname {arctanh}\left (\frac {\left (-1-5 x \right ) \sqrt {7}}{14 \sqrt {\left (3+x \right )^{2}-5 x -8}}\right )-2 \sqrt {\left (3+x \right )^{2}-4 x -5}+\frac {11 \,\operatorname {arcsinh}\left (\frac {\left (1+x \right ) \sqrt {3}}{3}\right )}{2}+2 \sqrt {7}\, \operatorname {arctanh}\left (\frac {\left (2-4 x \right ) \sqrt {7}}{14 \sqrt {\left (3+x \right )^{2}-4 x -5}}\right )+\frac {\left (1+2 x \right ) \sqrt {x^{2}+x +1}}{4}+\frac {\left (2 x +2\right ) \sqrt {x^{2}+2 x +4}}{4}\) \(140\)

Input:

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

Output:

-2*((3+x)^2-5*x-8)^(1/2)+43/8*arcsinh(2/3*3^(1/2)*(x+1/2))+2*7^(1/2)*arcta 
nh(1/14*(-1-5*x)*7^(1/2)/((3+x)^2-5*x-8)^(1/2))-2*((3+x)^2-4*x-5)^(1/2)+11 
/2*arcsinh(1/3*(1+x)*3^(1/2))+2*7^(1/2)*arctanh(1/14*(2-4*x)*7^(1/2)/((3+x 
)^2-4*x-5)^(1/2))+1/4*(1+2*x)*(x^2+x+1)^(1/2)+1/4*(2*x+2)*(x^2+2*x+4)^(1/2 
)
 

Fricas [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 155, normalized size of antiderivative = 0.98 \[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\frac {1}{4} \, \sqrt {x^{2} + x + 1} {\left (2 \, x - 7\right )} + \frac {1}{2} \, \sqrt {x^{2} + 2 \, x + 4} {\left (x - 3\right )} + 2 \, \sqrt {7} \log \left (\frac {2 \, \sqrt {7} {\left (5 \, x + 1\right )} + 2 \, \sqrt {x^{2} + x + 1} {\left (5 \, \sqrt {7} - 14\right )} - 25 \, x - 5}{x + 3}\right ) + 2 \, \sqrt {7} \log \left (\frac {\sqrt {7} {\left (2 \, x - 1\right )} + \sqrt {x^{2} + 2 \, x + 4} {\left (2 \, \sqrt {7} - 7\right )} - 4 \, x + 2}{x + 3}\right ) - \frac {11}{2} \, \log \left (-x + \sqrt {x^{2} + 2 \, x + 4} - 1\right ) - \frac {43}{8} \, \log \left (-2 \, x + 2 \, \sqrt {x^{2} + x + 1} - 1\right ) \] Input:

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

Output:

1/4*sqrt(x^2 + x + 1)*(2*x - 7) + 1/2*sqrt(x^2 + 2*x + 4)*(x - 3) + 2*sqrt 
(7)*log((2*sqrt(7)*(5*x + 1) + 2*sqrt(x^2 + x + 1)*(5*sqrt(7) - 14) - 25*x 
 - 5)/(x + 3)) + 2*sqrt(7)*log((sqrt(7)*(2*x - 1) + sqrt(x^2 + 2*x + 4)*(2 
*sqrt(7) - 7) - 4*x + 2)/(x + 3)) - 11/2*log(-x + sqrt(x^2 + 2*x + 4) - 1) 
 - 43/8*log(-2*x + 2*sqrt(x^2 + x + 1) - 1)
 

Sympy [F]

\[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\int \frac {x + 1}{- \sqrt {x^{2} + x + 1} + \sqrt {x^{2} + 2 x + 4}}\, dx \] Input:

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

Output:

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

Maxima [F]

\[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\int { \frac {x + 1}{\sqrt {x^{2} + 2 \, x + 4} - \sqrt {x^{2} + x + 1}} \,d x } \] Input:

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

Output:

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

Giac [F]

\[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\int { \frac {x + 1}{\sqrt {x^{2} + 2 \, x + 4} - \sqrt {x^{2} + x + 1}} \,d x } \] Input:

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

Output:

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

Mupad [F(-1)]

Timed out. \[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\int -\frac {x+1}{\sqrt {x^2+x+1}-\sqrt {x^2+2\,x+4}} \,d x \] Input:

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

Output:

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

Reduce [F]

\[ \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx=\int \frac {x +1}{-\sqrt {x^{2}+x +1}+\sqrt {x^{2}+2 x +4}}d x \] Input:

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

Output:

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