\(\int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} (1+x^2)}{x^2} \, dx\) [7622]

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

Optimal result

Integrand size = 35, antiderivative size = 26 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=3-e^{4-\frac {-1+x}{x}-x}+2 x-\log (x) \]

[Out]

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

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.77, number of steps used = 5, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.086, Rules used = {14, 45, 6838} \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2 x-e^{-x+\frac {1}{x}+3}-\log (x) \]

[In]

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

[Out]

-E^(3 + x^(-1) - x) + 2*x - Log[x]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 6838

Int[(F_)^(v_)*(u_), x_Symbol] :> With[{q = DerivativeDivides[v, u, x]}, Simp[q*(F^v/Log[F]), x] /;  !FalseQ[q]
] /; FreeQ[F, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {-1+2 x}{x}+\frac {e^{3+\frac {1}{x}-x} \left (1+x^2\right )}{x^2}\right ) \, dx \\ & = \int \frac {-1+2 x}{x} \, dx+\int \frac {e^{3+\frac {1}{x}-x} \left (1+x^2\right )}{x^2} \, dx \\ & = -e^{3+\frac {1}{x}-x}+\int \left (2-\frac {1}{x}\right ) \, dx \\ & = -e^{3+\frac {1}{x}-x}+2 x-\log (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.24 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.77 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=-e^{3+\frac {1}{x}-x}+2 x-\log (x) \]

[In]

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

[Out]

-E^(3 + x^(-1) - x) + 2*x - Log[x]

Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.96

method result size
risch \(2 x -\ln \left (x \right )-{\mathrm e}^{-\frac {x^{2}-3 x -1}{x}}\) \(25\)
parallelrisch \(2 x -\ln \left (x \right )-{\mathrm e}^{-\frac {x^{2}-3 x -1}{x}}\) \(25\)
parts \(2 x -\ln \left (x \right )-{\mathrm e}^{\frac {-x^{2}+3 x +1}{x}}\) \(26\)
norman \(\frac {2 x^{2}-x \,{\mathrm e}^{\frac {-x^{2}+3 x +1}{x}}}{x}-\ln \left (x \right )\) \(34\)

[In]

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

[Out]

2*x-ln(x)-exp(-(x^2-3*x-1)/x)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.92 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2 \, x - e^{\left (-\frac {x^{2} - 3 \, x - 1}{x}\right )} - \log \left (x\right ) \]

[In]

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

[Out]

2*x - e^(-(x^2 - 3*x - 1)/x) - log(x)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.65 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2 x - e^{\frac {- x^{2} + 3 x + 1}{x}} - \log {\left (x \right )} \]

[In]

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

[Out]

2*x - exp((-x**2 + 3*x + 1)/x) - log(x)

Maxima [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.73 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2 \, x - e^{\left (-x + \frac {1}{x} + 3\right )} - \log \left (x\right ) \]

[In]

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

[Out]

2*x - e^(-x + 1/x + 3) - log(x)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.92 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2 \, x - e^{\left (-\frac {x^{2} - 3 \, x - 1}{x}\right )} - \log \left (x\right ) \]

[In]

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

[Out]

2*x - e^(-(x^2 - 3*x - 1)/x) - log(x)

Mupad [B] (verification not implemented)

Time = 13.57 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.77 \[ \int \frac {-x+2 x^2+e^{\frac {1+3 x-x^2}{x}} \left (1+x^2\right )}{x^2} \, dx=2\,x-\ln \left (x\right )-{\mathrm {e}}^{-x}\,{\mathrm {e}}^{1/x}\,{\mathrm {e}}^3 \]

[In]

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

[Out]

2*x - log(x) - exp(-x)*exp(1/x)*exp(3)