3.102.81 \(\int \frac {1+x+e^{x+x^2} (-4 x-8 x^2)+e^{4+x} (2 x+2 x^2)+e^{2 x+2 x^2} (2 x+4 x^2)}{x} \, dx\) [10181]

Optimal. Leaf size=24 \[ -4+\left (-2+e^{x+x^2}\right )^2+x+2 e^{4+x} x+\log (x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.20, antiderivative size = 41, normalized size of antiderivative = 1.71, number of steps used = 11, number of rules used = 7, integrand size = 60, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.117, Rules used = {14, 2276, 2268, 6874, 2207, 2225, 45} \begin {gather*} -4 e^{x^2+x}+e^{2 x^2+2 x}+x-2 e^{x+4}+2 e^{x+4} (x+1)+\log (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(c + d*x)^m*
((b*F^(g*(e + f*x)))^n/(f*g*n*Log[F])), x] - Dist[d*(m/(f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*(b*F^(g*(e + f*x
)))^n, x], x] /; FreeQ[{F, b, c, d, e, f, g, n}, x] && GtQ[m, 0] && IntegerQ[2*m] &&  !TrueQ[$UseGamma]

Rule 2225

Int[((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.), x_Symbol] :> Simp[(F^(c*(a + b*x)))^n/(b*c*n*Log[F]), x] /; Fre
eQ[{F, a, b, c, n}, x]

Rule 2268

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

Rule 2276

Int[(F_)^(v_)*(u_)^(m_.), x_Symbol] :> Int[ExpandToSum[u, x]^m*F^ExpandToSum[v, x], x] /; FreeQ[{F, m}, x] &&
LinearQ[u, x] && QuadraticQ[v, x] &&  !(LinearMatchQ[u, x] && QuadraticMatchQ[v, x])

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 29, normalized size = 1.21 \begin {gather*} e^{2 x (1+x)}-4 e^{x+x^2}+x+2 e^{4+x} x+\log (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.03, size = 42, normalized size = 1.75

method result size
risch \(x +{\mathrm e}^{2 \left (x +1\right ) x}+2 x \,{\mathrm e}^{4+x}-4 \,{\mathrm e}^{\left (x +1\right ) x}+\ln \left (x \right )\) \(27\)
norman \(x +{\mathrm e}^{2 x^{2}+2 x}+2 x \,{\mathrm e}^{4+x}-4 \,{\mathrm e}^{x^{2}+x}+\ln \left (x \right )\) \(28\)
default \(x +\ln \left (x \right )+2 \,{\mathrm e}^{4} {\mathrm e}^{x}+2 \,{\mathrm e}^{4} \left ({\mathrm e}^{x} x -{\mathrm e}^{x}\right )-4 \,{\mathrm e}^{x^{2}+x}+{\mathrm e}^{2 x^{2}+2 x}\) \(42\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.51, size = 173, normalized size = 7.21 \begin {gather*} -\frac {1}{2} i \, \sqrt {2} \sqrt {\pi } \operatorname {erf}\left (i \, \sqrt {2} x + \frac {1}{2} i \, \sqrt {2}\right ) e^{\left (-\frac {1}{2}\right )} + 2 i \, \sqrt {\pi } \operatorname {erf}\left (i \, x + \frac {1}{2} i\right ) e^{\left (-\frac {1}{4}\right )} - \frac {1}{2} \, \sqrt {2} {\left (\frac {\sqrt {\pi } {\left (2 \, x + 1\right )} {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {-{\left (2 \, x + 1\right )}^{2}}\right ) - 1\right )}}{\sqrt {-{\left (2 \, x + 1\right )}^{2}}} - \sqrt {2} e^{\left (\frac {1}{2} \, {\left (2 \, x + 1\right )}^{2}\right )}\right )} e^{\left (-\frac {1}{2}\right )} + 2 \, {\left (\frac {\sqrt {\pi } {\left (2 \, x + 1\right )} {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {-{\left (2 \, x + 1\right )}^{2}}\right ) - 1\right )}}{\sqrt {-{\left (2 \, x + 1\right )}^{2}}} - 2 \, e^{\left (\frac {1}{4} \, {\left (2 \, x + 1\right )}^{2}\right )}\right )} e^{\left (-\frac {1}{4}\right )} + 2 \, {\left (x e^{4} - e^{4}\right )} e^{x} + x + 2 \, e^{\left (x + 4\right )} + \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.42, size = 29, normalized size = 1.21 \begin {gather*} 2 \, x e^{\left (x + 4\right )} + x + e^{\left (2 \, x^{2} + 2 \, x\right )} - 4 \, e^{\left (x^{2} + x\right )} + \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.11, size = 31, normalized size = 1.29 \begin {gather*} 2 x e^{x + 4} + x - 4 e^{x^{2} + x} + e^{2 x^{2} + 2 x} + \log {\left (x \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.42, size = 29, normalized size = 1.21 \begin {gather*} 2 \, x e^{\left (x + 4\right )} + x + e^{\left (2 \, x^{2} + 2 \, x\right )} - 4 \, e^{\left (x^{2} + x\right )} + \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.16, size = 29, normalized size = 1.21 \begin {gather*} x-4\,{\mathrm {e}}^{x^2+x}+{\mathrm {e}}^{2\,x^2+2\,x}+\ln \left (x\right )+2\,x\,{\mathrm {e}}^{x+4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________