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

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

Optimal result

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

[Out]

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

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68, number of steps used = 6, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {14, 2259, 2240, 45} \[ \int \frac {1+2 x+e^{1-2 x+x^2} \left (-2 x+2 x^2\right )}{x} \, dx=2 x+e^{(x-1)^2}+\log (x) \]

[In]

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

[Out]

E^(-1 + x)^2 + 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 2240

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Simp[(e + f*x)^n*(
F^(a + b*(c + d*x)^n)/(b*f*n*(c + d*x)^n*Log[F])), x] /; FreeQ[{F, a, b, c, d, e, f, n}, x] && EqQ[m, n - 1] &
& EqQ[d*e - c*f, 0]

Rule 2259

Int[(u_.)*(F_)^((a_.) + (b_.)*(v_)), x_Symbol] :> Int[u*F^(a + b*NormalizePowerOfLinear[v, x]), x] /; FreeQ[{F
, a, b}, x] && PolynomialQ[u, x] && PowerOfLinearQ[v, x] &&  !PowerOfLinearMatchQ[v, x]

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.08 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68

method result size
risch \(2 x +{\mathrm e}^{\left (-1+x \right )^{2}}+\ln \left (x \right )\) \(13\)
norman \(2 x +{\mathrm e}^{x^{2}-2 x +1}+\ln \left (x \right )\) \(16\)
parallelrisch \(2 x +{\mathrm e}^{x^{2}-2 x +1}+\ln \left (x \right )\) \(16\)
default \(2 x +\ln \left (x \right )+i {\mathrm e} \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x -i\right )+2 \,{\mathrm e} \left (\frac {{\mathrm e}^{x^{2}-2 x}}{2}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x -i\right )}{2}\right )\) \(56\)
parts \(2 x +\ln \left (x \right )+i {\mathrm e} \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x -i\right )+2 \,{\mathrm e} \left (\frac {{\mathrm e}^{x^{2}-2 x}}{2}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x -i\right )}{2}\right )\) \(56\)

[In]

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

[Out]

2*x+exp((-1+x)^2)+ln(x)

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

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

Time = 0.22 (sec) , antiderivative size = 51, normalized size of antiderivative = 2.68 \[ \int \frac {1+2 x+e^{1-2 x+x^2} \left (-2 x+2 x^2\right )}{x} \, dx=\frac {\sqrt {\pi } {\left (x - 1\right )} {\left (\operatorname {erf}\left (\sqrt {-{\left (x - 1\right )}^{2}}\right ) - 1\right )}}{\sqrt {-{\left (x - 1\right )}^{2}}} + i \, \sqrt {\pi } \operatorname {erf}\left (i \, x - i\right ) + 2 \, x + e^{\left ({\left (x - 1\right )}^{2}\right )} + \log \left (x\right ) \]

[In]

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

[Out]

sqrt(pi)*(x - 1)*(erf(sqrt(-(x - 1)^2)) - 1)/sqrt(-(x - 1)^2) + I*sqrt(pi)*erf(I*x - I) + 2*x + e^((x - 1)^2)
+ log(x)

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {1+2 x+e^{1-2 x+x^2} \left (-2 x+2 x^2\right )}{x} \, dx=2\,x+\ln \left (x\right )+{\mathrm {e}}^{-2\,x}\,{\mathrm {e}}^{x^2}\,\mathrm {e} \]

[In]

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

[Out]

2*x + log(x) + exp(-2*x)*exp(x^2)*exp(1)