\(\int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} (-1-14 x-4 x^2)+e^{-16-7 x-x^2} (2+14 x-22 x^2-22 x^3-4 x^4)}{x^2} \, dx\) [8796]

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

Optimal result

Integrand size = 77, antiderivative size = 28 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=x+x \left (2+\frac {-1+e^{-(-4-x)^2+x}}{x}+x\right )^2 \]

[Out]

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

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(93\) vs. \(2(28)=56\).

Time = 0.29 (sec) , antiderivative size = 93, normalized size of antiderivative = 3.32, number of steps used = 21, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.104, Rules used = {14, 2326, 6874, 2266, 2236, 2274, 2272, 2273} \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=x^3+4 x^2+2 e^{-x^2-7 x-16} x+4 e^{-x^2-7 x-16}-\frac {2 e^{-x^2-7 x-16}}{x}+\frac {e^{-2 x^2-14 x-32} \left (2 x^2+7 x\right )}{(2 x+7) x^2}+3 x+\frac {1}{x} \]

[In]

Int[(-1 + 3*x^2 + 8*x^3 + 3*x^4 + E^(-32 - 14*x - 2*x^2)*(-1 - 14*x - 4*x^2) + E^(-16 - 7*x - x^2)*(2 + 14*x -
 22*x^2 - 22*x^3 - 4*x^4))/x^2,x]

[Out]

4*E^(-16 - 7*x - x^2) + x^(-1) - (2*E^(-16 - 7*x - x^2))/x + 3*x + 2*E^(-16 - 7*x - x^2)*x + 4*x^2 + x^3 + (E^
(-32 - 14*x - 2*x^2)*(7*x + 2*x^2))/(x^2*(7 + 2*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 2236

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erf[(c + d*x)*Rt[(-b)*Log[F],
 2]]/(2*d*Rt[(-b)*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && NegQ[b]

Rule 2266

Int[(F_)^((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[F^(a - b^2/(4*c)), Int[F^((b + 2*c*x)^2/(4*c))
, x], x] /; FreeQ[{F, a, b, c}, x]

Rule 2272

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] - Dist[(b*e - 2*c*d)/(2*c), Int[F^(a + b*x + c*x^2), x], x] /; FreeQ[{F, a, b, c, d, e}, x] &&
 NeQ[b*e - 2*c*d, 0]

Rule 2273

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

Rule 2274

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

Rule 2326

Int[(y_.)*(F_)^(u_)*((v_) + (w_)), x_Symbol] :> With[{z = v*(y/(Log[F]*D[u, x]))}, Simp[F^u*z, x] /; EqQ[D[z,
x], w*y]] /; FreeQ[F, x]

Rule 6874

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

Rubi steps \begin{align*} \text {integral}& = \int \left (-\frac {e^{-32-14 x-2 x^2} \left (1+14 x+4 x^2\right )}{x^2}-\frac {2 e^{-16-7 x-x^2} \left (-1-7 x+11 x^2+11 x^3+2 x^4\right )}{x^2}+\frac {-1+3 x^2+8 x^3+3 x^4}{x^2}\right ) \, dx \\ & = -\left (2 \int \frac {e^{-16-7 x-x^2} \left (-1-7 x+11 x^2+11 x^3+2 x^4\right )}{x^2} \, dx\right )-\int \frac {e^{-32-14 x-2 x^2} \left (1+14 x+4 x^2\right )}{x^2} \, dx+\int \frac {-1+3 x^2+8 x^3+3 x^4}{x^2} \, dx \\ & = \frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)}-2 \int \left (11 e^{-16-7 x-x^2}-\frac {e^{-16-7 x-x^2}}{x^2}-\frac {7 e^{-16-7 x-x^2}}{x}+11 e^{-16-7 x-x^2} x+2 e^{-16-7 x-x^2} x^2\right ) \, dx+\int \left (3-\frac {1}{x^2}+8 x+3 x^2\right ) \, dx \\ & = \frac {1}{x}+3 x+4 x^2+x^3+\frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)}+2 \int \frac {e^{-16-7 x-x^2}}{x^2} \, dx-4 \int e^{-16-7 x-x^2} x^2 \, dx+14 \int \frac {e^{-16-7 x-x^2}}{x} \, dx-22 \int e^{-16-7 x-x^2} \, dx-22 \int e^{-16-7 x-x^2} x \, dx \\ & = 11 e^{-16-7 x-x^2}+\frac {1}{x}-\frac {2 e^{-16-7 x-x^2}}{x}+3 x+2 e^{-16-7 x-x^2} x+4 x^2+x^3+\frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)}-2 \int e^{-16-7 x-x^2} \, dx-4 \int e^{-16-7 x-x^2} \, dx+14 \int e^{-16-7 x-x^2} x \, dx+77 \int e^{-16-7 x-x^2} \, dx-\frac {22 \int e^{-\frac {1}{4} (-7-2 x)^2} \, dx}{e^{15/4}} \\ & = 4 e^{-16-7 x-x^2}+\frac {1}{x}-\frac {2 e^{-16-7 x-x^2}}{x}+3 x+2 e^{-16-7 x-x^2} x+4 x^2+x^3+\frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)}+\frac {11 \sqrt {\pi } \text {erf}\left (\frac {1}{2} (-7-2 x)\right )}{e^{15/4}}-49 \int e^{-16-7 x-x^2} \, dx-\frac {2 \int e^{-\frac {1}{4} (-7-2 x)^2} \, dx}{e^{15/4}}-\frac {4 \int e^{-\frac {1}{4} (-7-2 x)^2} \, dx}{e^{15/4}}+\frac {77 \int e^{-\frac {1}{4} (-7-2 x)^2} \, dx}{e^{15/4}} \\ & = 4 e^{-16-7 x-x^2}+\frac {1}{x}-\frac {2 e^{-16-7 x-x^2}}{x}+3 x+2 e^{-16-7 x-x^2} x+4 x^2+x^3+\frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)}-\frac {49 \sqrt {\pi } \text {erf}\left (\frac {1}{2} (-7-2 x)\right )}{2 e^{15/4}}-\frac {49 \int e^{-\frac {1}{4} (-7-2 x)^2} \, dx}{e^{15/4}} \\ & = 4 e^{-16-7 x-x^2}+\frac {1}{x}-\frac {2 e^{-16-7 x-x^2}}{x}+3 x+2 e^{-16-7 x-x^2} x+4 x^2+x^3+\frac {e^{-32-14 x-2 x^2} \left (7 x+2 x^2\right )}{x^2 (7+2 x)} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(63\) vs. \(2(28)=56\).

Time = 7.50 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.25 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=\frac {1}{x}+\frac {e^{-32-14 x-2 x^2}}{x}+3 x+4 x^2+x^3+e^{-7 x-x^2} \left (\frac {4}{e^{16}}-\frac {2}{e^{16} x}+\frac {2 x}{e^{16}}\right ) \]

[In]

Integrate[(-1 + 3*x^2 + 8*x^3 + 3*x^4 + E^(-32 - 14*x - 2*x^2)*(-1 - 14*x - 4*x^2) + E^(-16 - 7*x - x^2)*(2 +
14*x - 22*x^2 - 22*x^3 - 4*x^4))/x^2,x]

[Out]

x^(-1) + E^(-32 - 14*x - 2*x^2)/x + 3*x + 4*x^2 + x^3 + E^(-7*x - x^2)*(4/E^16 - 2/(E^16*x) + (2*x)/E^16)

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(56\) vs. \(2(27)=54\).

Time = 0.43 (sec) , antiderivative size = 57, normalized size of antiderivative = 2.04

method result size
risch \(4 x^{2}+3 x +\frac {1}{x}+x^{3}+\frac {{\mathrm e}^{-2 x^{2}-14 x -32}}{x}+\frac {2 \left (x^{2}+2 x -1\right ) {\mathrm e}^{-x^{2}-7 x -16}}{x}\) \(57\)
norman \(\frac {x^{4}+2 \,{\mathrm e}^{-x^{2}-7 x -16} x^{2}+4 x^{3}+4 \,{\mathrm e}^{-x^{2}-7 x -16} x +3 x^{2}+{\mathrm e}^{-2 x^{2}-14 x -32}-2 \,{\mathrm e}^{-x^{2}-7 x -16}+1}{x}\) \(76\)
parallelrisch \(\frac {x^{4}+2 \,{\mathrm e}^{-x^{2}-7 x -16} x^{2}+4 x^{3}+4 \,{\mathrm e}^{-x^{2}-7 x -16} x +3 x^{2}+{\mathrm e}^{-2 x^{2}-14 x -32}-2 \,{\mathrm e}^{-x^{2}-7 x -16}+1}{x}\) \(76\)
parts \(4 x^{2}+3 x +\frac {1}{x}+x^{3}+\frac {{\mathrm e}^{-2 x^{2}-14 x -32}}{x}+\frac {4 \,{\mathrm e}^{-x^{2}-7 x -16} x +2 \,{\mathrm e}^{-x^{2}-7 x -16} x^{2}-2 \,{\mathrm e}^{-x^{2}-7 x -16}}{x}\) \(81\)

[In]

int(((-4*x^2-14*x-1)*exp(-x^2-7*x-16)^2+(-4*x^4-22*x^3-22*x^2+14*x+2)*exp(-x^2-7*x-16)+3*x^4+8*x^3+3*x^2-1)/x^
2,x,method=_RETURNVERBOSE)

[Out]

4*x^2+3*x+1/x+x^3+1/x*exp(-x^2-7*x-16)^2+2*(x^2+2*x-1)/x*exp(-x^2-7*x-16)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 51 vs. \(2 (25) = 50\).

Time = 0.30 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.82 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=\frac {x^{4} + 4 \, x^{3} + 3 \, x^{2} + 2 \, {\left (x^{2} + 2 \, x - 1\right )} e^{\left (-x^{2} - 7 \, x - 16\right )} + e^{\left (-2 \, x^{2} - 14 \, x - 32\right )} + 1}{x} \]

[In]

integrate(((-4*x^2-14*x-1)*exp(-x^2-7*x-16)^2+(-4*x^4-22*x^3-22*x^2+14*x+2)*exp(-x^2-7*x-16)+3*x^4+8*x^3+3*x^2
-1)/x^2,x, algorithm="fricas")

[Out]

(x^4 + 4*x^3 + 3*x^2 + 2*(x^2 + 2*x - 1)*e^(-x^2 - 7*x - 16) + e^(-2*x^2 - 14*x - 32) + 1)/x

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (20) = 40\).

Time = 0.09 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.07 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=x^{3} + 4 x^{2} + 3 x + \frac {1}{x} + \frac {x e^{- 2 x^{2} - 14 x - 32} + \left (2 x^{3} + 4 x^{2} - 2 x\right ) e^{- x^{2} - 7 x - 16}}{x^{2}} \]

[In]

integrate(((-4*x**2-14*x-1)*exp(-x**2-7*x-16)**2+(-4*x**4-22*x**3-22*x**2+14*x+2)*exp(-x**2-7*x-16)+3*x**4+8*x
**3+3*x**2-1)/x**2,x)

[Out]

x**3 + 4*x**2 + 3*x + 1/x + (x*exp(-2*x**2 - 14*x - 32) + (2*x**3 + 4*x**2 - 2*x)*exp(-x**2 - 7*x - 16))/x**2

Maxima [F]

\[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=\int { \frac {3 \, x^{4} + 8 \, x^{3} + 3 \, x^{2} - 2 \, {\left (2 \, x^{4} + 11 \, x^{3} + 11 \, x^{2} - 7 \, x - 1\right )} e^{\left (-x^{2} - 7 \, x - 16\right )} - {\left (4 \, x^{2} + 14 \, x + 1\right )} e^{\left (-2 \, x^{2} - 14 \, x - 32\right )} - 1}{x^{2}} \,d x } \]

[In]

integrate(((-4*x^2-14*x-1)*exp(-x^2-7*x-16)^2+(-4*x^4-22*x^3-22*x^2+14*x+2)*exp(-x^2-7*x-16)+3*x^4+8*x^3+3*x^2
-1)/x^2,x, algorithm="maxima")

[Out]

x^3 - sqrt(2)*sqrt(pi)*erf(sqrt(2)*x + 7/2*sqrt(2))*e^(-15/2) + 4*x^2 + 3*x + 2*(x^2 + 2*x - 1)*e^(-x^2 - 7*x
- 16)/x + 1/x - integrate((14*x + 1)*e^(-2*x^2 - 14*x - 32)/x^2, x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 83 vs. \(2 (25) = 50\).

Time = 0.28 (sec) , antiderivative size = 83, normalized size of antiderivative = 2.96 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=\frac {{\left (x^{4} e^{48} + 4 \, x^{3} e^{48} + 3 \, x^{2} e^{48} + 2 \, x^{2} e^{\left (-x^{2} - 7 \, x + 32\right )} + 4 \, x e^{\left (-x^{2} - 7 \, x + 32\right )} + e^{48} - 2 \, e^{\left (-x^{2} - 7 \, x + 32\right )} + e^{\left (-2 \, x^{2} - 14 \, x + 16\right )}\right )} e^{\left (-48\right )}}{x} \]

[In]

integrate(((-4*x^2-14*x-1)*exp(-x^2-7*x-16)^2+(-4*x^4-22*x^3-22*x^2+14*x+2)*exp(-x^2-7*x-16)+3*x^4+8*x^3+3*x^2
-1)/x^2,x, algorithm="giac")

[Out]

(x^4*e^48 + 4*x^3*e^48 + 3*x^2*e^48 + 2*x^2*e^(-x^2 - 7*x + 32) + 4*x*e^(-x^2 - 7*x + 32) + e^48 - 2*e^(-x^2 -
 7*x + 32) + e^(-2*x^2 - 14*x + 16))*e^(-48)/x

Mupad [B] (verification not implemented)

Time = 14.31 (sec) , antiderivative size = 73, normalized size of antiderivative = 2.61 \[ \int \frac {-1+3 x^2+8 x^3+3 x^4+e^{-32-14 x-2 x^2} \left (-1-14 x-4 x^2\right )+e^{-16-7 x-x^2} \left (2+14 x-22 x^2-22 x^3-4 x^4\right )}{x^2} \, dx=3\,x+4\,{\mathrm {e}}^{-x^2-7\,x-16}-\frac {2\,{\mathrm {e}}^{-x^2-7\,x-16}}{x}+\frac {{\mathrm {e}}^{-2\,x^2-14\,x-32}}{x}+2\,x\,{\mathrm {e}}^{-x^2-7\,x-16}+\frac {1}{x}+4\,x^2+x^3 \]

[In]

int(-(exp(- 7*x - x^2 - 16)*(22*x^2 - 14*x + 22*x^3 + 4*x^4 - 2) + exp(- 14*x - 2*x^2 - 32)*(14*x + 4*x^2 + 1)
 - 3*x^2 - 8*x^3 - 3*x^4 + 1)/x^2,x)

[Out]

3*x + 4*exp(- 7*x - x^2 - 16) - (2*exp(- 7*x - x^2 - 16))/x + exp(- 14*x - 2*x^2 - 32)/x + 2*x*exp(- 7*x - x^2
 - 16) + 1/x + 4*x^2 + x^3