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

Optimal. Leaf size=25 \[ x-4 \sqrt {x}+\frac {4}{\sqrt {x}}-\frac {1}{x}+3 \log (x) \]

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {1357, 698} \[ x-4 \sqrt {x}+\frac {4}{\sqrt {x}}-\frac {1}{x}+3 \log (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x^(-1) + 4/Sqrt[x] - 4*Sqrt[x] + x + 3*Log[x]

Rule 698

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d +
 e*x)^m*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*
e + a*e^2, 0] && NeQ[2*c*d - b*e, 0] && IntegerQ[p] && (GtQ[p, 0] || (EqQ[a, 0] && IntegerQ[m]))

Rule 1357

Int[(x_)^(m_.)*((a_) + (c_.)*(x_)^(n2_.) + (b_.)*(x_)^(n_))^(p_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*x + c*x^2)^p, x], x, x^n], x] /; FreeQ[{a, b, c, m, n, p}, x] && EqQ[n2, 2*n] && NeQ[
b^2 - 4*a*c, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rubi steps

\begin {align*} \int \frac {\left (1-\sqrt {x}+x\right )^2}{x^2} \, dx &=2 \operatorname {Subst}\left (\int \frac {\left (1-x+x^2\right )^2}{x^3} \, dx,x,\sqrt {x}\right )\\ &=2 \operatorname {Subst}\left (\int \left (-2+\frac {1}{x^3}-\frac {2}{x^2}+\frac {3}{x}+x\right ) \, dx,x,\sqrt {x}\right )\\ &=-\frac {1}{x}+\frac {4}{\sqrt {x}}-4 \sqrt {x}+x+3 \log (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 25, normalized size = 1.00 \[ x-4 \sqrt {x}+\frac {4}{\sqrt {x}}-\frac {1}{x}+3 \log (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x^(-1) + 4/Sqrt[x] - 4*Sqrt[x] + x + 3*Log[x]

________________________________________________________________________________________

IntegrateAlgebraic [A]  time = 0.01, size = 25, normalized size = 1.00 \[ x-4 \sqrt {x}+\frac {4}{\sqrt {x}}-\frac {1}{x}+3 \log (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x^(-1) + 4/Sqrt[x] - 4*Sqrt[x] + x + 3*Log[x]

________________________________________________________________________________________

fricas [A]  time = 1.08, size = 24, normalized size = 0.96 \[ \frac {x^{2} + 6 \, x \log \left (\sqrt {x}\right ) - 4 \, {\left (x - 1\right )} \sqrt {x} - 1}{x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(x^2 + 6*x*log(sqrt(x)) - 4*(x - 1)*sqrt(x) - 1)/x

________________________________________________________________________________________

giac [A]  time = 1.00, size = 23, normalized size = 0.92 \[ x - 4 \, \sqrt {x} + \frac {4 \, \sqrt {x} - 1}{x} + 3 \, \log \left ({\left | x \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x - 4*sqrt(x) + (4*sqrt(x) - 1)/x + 3*log(abs(x))

________________________________________________________________________________________

maple [A]  time = 0.11, size = 22, normalized size = 0.88




method result size



derivativedivides \(-\frac {1}{x}+x +3 \ln \relax (x )+\frac {4}{\sqrt {x}}-4 \sqrt {x}\) \(22\)
default \(-\frac {1}{x}+x +3 \ln \relax (x )+\frac {4}{\sqrt {x}}-4 \sqrt {x}\) \(22\)
trager \(\frac {\left (-1+x \right ) \left (1+x \right )}{x}-\frac {4 \left (-1+x \right )}{\sqrt {x}}-3 \ln \left (\frac {1}{x}\right )\) \(26\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.43, size = 22, normalized size = 0.88 \[ x - 4 \, \sqrt {x} + \frac {4 \, \sqrt {x} - 1}{x} + 3 \, \log \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x - 4*sqrt(x) + (4*sqrt(x) - 1)/x + 3*log(x)

________________________________________________________________________________________

mupad [B]  time = 0.04, size = 24, normalized size = 0.96 \[ x+6\,\ln \left (\sqrt {x}\right )+\frac {4\,\sqrt {x}-1}{x}-4\,\sqrt {x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + 6*log(x^(1/2)) + (4*x^(1/2) - 1)/x - 4*x^(1/2)

________________________________________________________________________________________

sympy [A]  time = 0.42, size = 22, normalized size = 0.88 \[ - 4 \sqrt {x} + x + 3 \log {\relax (x )} - \frac {1}{x} + \frac {4}{\sqrt {x}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-4*sqrt(x) + x + 3*log(x) - 1/x + 4/sqrt(x)

________________________________________________________________________________________