\(\int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x (-4+2 x+x^2)-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx\) [624]

   Optimal result
   Rubi [B] (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 = 57, antiderivative size = 21 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=x+\frac {3+\frac {e^x}{x}+\log (x)}{8+2 x} \]

[Out]

x+(3+ln(x)+exp(x)/x)/(2*x+8)

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(51\) vs. \(2(21)=42\).

Time = 0.47 (sec) , antiderivative size = 51, normalized size of antiderivative = 2.43, number of steps used = 21, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.175, Rules used = {1608, 27, 12, 6874, 46, 45, 2208, 2209, 2351, 31} \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=x-\frac {e^x}{8 (x+4)}+\frac {3}{2 (x+4)}+\frac {e^x}{8 x}-\frac {x \log (x)}{8 (x+4)}+\frac {\log (x)}{8} \]

[In]

Int[(4*x + 30*x^2 + 16*x^3 + 2*x^4 + E^x*(-4 + 2*x + x^2) - x^2*Log[x])/(32*x^2 + 16*x^3 + 2*x^4),x]

[Out]

E^x/(8*x) + x + 3/(2*(4 + x)) - E^x/(8*(4 + x)) + Log[x]/8 - (x*Log[x])/(8*(4 + x))

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 27

Int[(u_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[u*Cancel[(b/2 + c*x)^(2*p)/c^p], x] /; Fr
eeQ[{a, b, c}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[p]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

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 46

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}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 1608

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.) + (c_.)*(x_)^(r_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^
(q - p) + c*x^(r - p))^n, x] /; FreeQ[{a, b, c, p, q, r}, x] && IntegerQ[n] && PosQ[q - p] && PosQ[r - p]

Rule 2208

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_), x_Symbol] :> Simp[(c + d*x)^(m
+ 1)*((b*F^(g*(e + f*x)))^n/(d*(m + 1))), x] - Dist[f*g*n*(Log[F]/(d*(m + 1))), 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] && LtQ[m, -1] && IntegerQ[2*m] &&  !TrueQ[$UseGamm
a]

Rule 2209

Int[(F_)^((g_.)*((e_.) + (f_.)*(x_)))/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[(F^(g*(e - c*(f/d)))/d)*ExpInteg
ralEi[f*g*(c + d*x)*(Log[F]/d)], x] /; FreeQ[{F, c, d, e, f, g}, x] &&  !TrueQ[$UseGamma]

Rule 2351

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_) + (e_.)*(x_)^(r_.))^(q_), x_Symbol] :> Simp[x*(d + e*x^r)^(q +
 1)*((a + b*Log[c*x^n])/d), x] - Dist[b*(n/d), Int[(d + e*x^r)^(q + 1), x], x] /; FreeQ[{a, b, c, d, e, n, q,
r}, x] && EqQ[r*(q + 1) + 1, 0]

Rule 6874

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

Rubi steps \begin{align*} \text {integral}& = \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{x^2 \left (32+16 x+2 x^2\right )} \, dx \\ & = \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{2 x^2 (4+x)^2} \, dx \\ & = \frac {1}{2} \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{x^2 (4+x)^2} \, dx \\ & = \frac {1}{2} \int \left (\frac {30}{(4+x)^2}+\frac {4}{x (4+x)^2}+\frac {16 x}{(4+x)^2}+\frac {2 x^2}{(4+x)^2}+\frac {e^x \left (-4+2 x+x^2\right )}{x^2 (4+x)^2}-\frac {\log (x)}{(4+x)^2}\right ) \, dx \\ & = -\frac {15}{4+x}+\frac {1}{2} \int \frac {e^x \left (-4+2 x+x^2\right )}{x^2 (4+x)^2} \, dx-\frac {1}{2} \int \frac {\log (x)}{(4+x)^2} \, dx+2 \int \frac {1}{x (4+x)^2} \, dx+8 \int \frac {x}{(4+x)^2} \, dx+\int \frac {x^2}{(4+x)^2} \, dx \\ & = -\frac {15}{4+x}-\frac {x \log (x)}{8 (4+x)}+\frac {1}{8} \int \frac {1}{4+x} \, dx+\frac {1}{2} \int \left (-\frac {e^x}{4 x^2}+\frac {e^x}{4 x}+\frac {e^x}{4 (4+x)^2}-\frac {e^x}{4 (4+x)}\right ) \, dx+2 \int \left (\frac {1}{16 x}-\frac {1}{4 (4+x)^2}-\frac {1}{16 (4+x)}\right ) \, dx+8 \int \left (-\frac {4}{(4+x)^2}+\frac {1}{4+x}\right ) \, dx+\int \left (1+\frac {16}{(4+x)^2}-\frac {8}{4+x}\right ) \, dx \\ & = x+\frac {3}{2 (4+x)}+\frac {\log (x)}{8}-\frac {x \log (x)}{8 (4+x)}-\frac {1}{8} \int \frac {e^x}{x^2} \, dx+\frac {1}{8} \int \frac {e^x}{x} \, dx+\frac {1}{8} \int \frac {e^x}{(4+x)^2} \, dx-\frac {1}{8} \int \frac {e^x}{4+x} \, dx \\ & = \frac {e^x}{8 x}+x+\frac {3}{2 (4+x)}-\frac {e^x}{8 (4+x)}+\frac {\operatorname {ExpIntegralEi}(x)}{8}-\frac {\operatorname {ExpIntegralEi}(4+x)}{8 e^4}+\frac {\log (x)}{8}-\frac {x \log (x)}{8 (4+x)}-\frac {1}{8} \int \frac {e^x}{x} \, dx+\frac {1}{8} \int \frac {e^x}{4+x} \, dx \\ & = \frac {e^x}{8 x}+x+\frac {3}{2 (4+x)}-\frac {e^x}{8 (4+x)}+\frac {\log (x)}{8}-\frac {x \log (x)}{8 (4+x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.25 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.52 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=\frac {e^x+x \left (3+8 x+2 x^2\right )+x \log (x)}{2 x (4+x)} \]

[In]

Integrate[(4*x + 30*x^2 + 16*x^3 + 2*x^4 + E^x*(-4 + 2*x + x^2) - x^2*Log[x])/(32*x^2 + 16*x^3 + 2*x^4),x]

[Out]

(E^x + x*(3 + 8*x + 2*x^2) + x*Log[x])/(2*x*(4 + x))

Maple [A] (verified)

Time = 0.08 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.24

method result size
norman \(\frac {x^{3}-\frac {29 x}{2}+\frac {x \ln \left (x \right )}{2}+\frac {{\mathrm e}^{x}}{2}}{\left (4+x \right ) x}\) \(26\)
parallelrisch \(-\frac {-8 x^{3}-4 x \ln \left (x \right )+116 x -4 \,{\mathrm e}^{x}}{8 x \left (4+x \right )}\) \(29\)
risch \(\frac {\ln \left (x \right )}{2 x +8}+\frac {2 x^{3}+8 x^{2}+3 x +{\mathrm e}^{x}}{2 \left (4+x \right ) x}\) \(37\)
default \(-\frac {{\mathrm e}^{x}}{8 \left (4+x \right )}+\frac {{\mathrm e}^{x}}{8 x}-\frac {\ln \left (x \right ) x}{8 \left (4+x \right )}+x +\frac {\ln \left (x \right )}{8}+\frac {3}{2 \left (4+x \right )}\) \(40\)
parts \(-\frac {{\mathrm e}^{x}}{8 \left (4+x \right )}+\frac {{\mathrm e}^{x}}{8 x}-\frac {\ln \left (x \right ) x}{8 \left (4+x \right )}+x +\frac {\ln \left (x \right )}{8}+\frac {3}{2 \left (4+x \right )}\) \(40\)

[In]

int((-x^2*ln(x)+(x^2+2*x-4)*exp(x)+2*x^4+16*x^3+30*x^2+4*x)/(2*x^4+16*x^3+32*x^2),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.48 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=\frac {2 \, x^{3} + 8 \, x^{2} + x \log \left (x\right ) + 3 \, x + e^{x}}{2 \, {\left (x^{2} + 4 \, x\right )}} \]

[In]

integrate((-x^2*log(x)+(x^2+2*x-4)*exp(x)+2*x^4+16*x^3+30*x^2+4*x)/(2*x^4+16*x^3+32*x^2),x, algorithm="fricas"
)

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.29 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=x + \frac {e^{x}}{2 x^{2} + 8 x} + \frac {\log {\left (x \right )}}{2 x + 8} + \frac {3}{2 x + 8} \]

[In]

integrate((-x**2*ln(x)+(x**2+2*x-4)*exp(x)+2*x**4+16*x**3+30*x**2+4*x)/(2*x**4+16*x**3+32*x**2),x)

[Out]

x + exp(x)/(2*x**2 + 8*x) + log(x)/(2*x + 8) + 3/(2*x + 8)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.29 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=x + \frac {x \log \left (x\right ) + e^{x}}{2 \, {\left (x^{2} + 4 \, x\right )}} + \frac {3}{2 \, {\left (x + 4\right )}} \]

[In]

integrate((-x^2*log(x)+(x^2+2*x-4)*exp(x)+2*x^4+16*x^3+30*x^2+4*x)/(2*x^4+16*x^3+32*x^2),x, algorithm="maxima"
)

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.48 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=\frac {2 \, x^{3} + 8 \, x^{2} + x \log \left (x\right ) + 3 \, x + e^{x}}{2 \, {\left (x^{2} + 4 \, x\right )}} \]

[In]

integrate((-x^2*log(x)+(x^2+2*x-4)*exp(x)+2*x^4+16*x^3+30*x^2+4*x)/(2*x^4+16*x^3+32*x^2),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 9.14 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.14 \[ \int \frac {4 x+30 x^2+16 x^3+2 x^4+e^x \left (-4+2 x+x^2\right )-x^2 \log (x)}{32 x^2+16 x^3+2 x^4} \, dx=x+\frac {\frac {{\mathrm {e}}^x}{2}+x\,\left (\frac {\ln \left (x\right )}{2}+\frac {3}{2}\right )}{x\,\left (x+4\right )} \]

[In]

int((4*x - x^2*log(x) + exp(x)*(2*x + x^2 - 4) + 30*x^2 + 16*x^3 + 2*x^4)/(32*x^2 + 16*x^3 + 2*x^4),x)

[Out]

x + (exp(x)/2 + x*(log(x)/2 + 3/2))/(x*(x + 4))